我正在努力避免滚动页面时出现恼人的缩放效果。
我在一个展示传单的iframe里面。
我用这个代码来防止缩放:
<div class="overlay" onClick="style.pointerEvents='none'"></div>
.overlay {
background: transparent;
position: absolute;
width: 100%;
height: 100%;
top: 0px;
margin-top: 49px;
}
它在缩放时工作良好,但也可以防止单击导航箭头。
有没有一种方法可以完全禁用鼠标滚轮的缩放并保持单击活动?或者更好的是,有没有办法在按下ctrl
键时使其缩放?
来自文档:
Name : scrollWheelZoom
Type : Boolean|String
Default : true
Description : Whether the map can be zoomed by using the mouse wheel. If passed 'center', it will zoom to the center of the view regardless of where the mouse was.
将scrollWheelZoom设置为false。