传单与位置:固定叶灰色轨迹后滚动
Leaflet with position:fixed leaves gray trail after scrolling
我正在尝试制作包含两个div的网站:
- 左,可滚动内容
- 右,不移动(位置固定),仅包含标签和传单地图
当我滚动页面时,传单会留下灰色痕迹,我想摆脱这些痕迹。
我在这里找到的(在stackoverflow)是map.invalidateSize(),但它对我没有帮助。
在此处观看完整的 jsfiddle 示例。
.HTML:
<div id="map">
</div>
<div id="content">
Heres the text<br />
...
</div>
.CSS:
html, body, #map {
width: 100%;
height: 100%;
}
#map{
width: 400px;
height: 400px;
position: fixed;
left: 60%;
top: 30%;
}
.JS:
// create a map in the "map" div, set the view to a given place and zoom
var map = L.map('map').setView([51.505, -0.09], 13);
// add an OpenStreetMap tile layer
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
window.map = map;
$(document).ready(function(){
$(window).scroll(function(){
window.map.invalidateSize();
})
})
将其
更改为background: none;
#map{
width: 400px;
height: 400px;
background: none;
position: fixed;
left: 60%;
top: 30%;
}
相关文章:
- 幻灯片滚动javascript不起作用
- 将视口底部滚动到元素底部
- jQuery Lazy加载动画滚动
- 设置滑块分区上的滚动
- 结合jQuery和jetpack无限滚动
- 单击顶部导航时如何进行向下滚动效果(向下滑动).
- 滚动到容器中的下一个元素-几乎到了
- 只覆盖箭头键滚动事件
- Javascript如何找到滚动事件的来源
- Image赢得't隐藏在滚动jQuery上
- Safari(Mac OS)上的jQuery平滑滚动问题
- CSS-若窗口太小,滚动条会出现在“表格”单元格上
- 禁用(而不是隐藏)浏览器滚动条
- JavaScript上下滚动不可预测
- Javascript时间轨迹
- 滚动和表格
- 谷歌地图劫持了iphone's滚动(触摸事件)-如何恢复
- 我希望只有在我滚动页面后才能显示我的返回页首图标
- 循环滚动数组
- 传单与位置:固定叶灰色轨迹后滚动