把百度地圖引動到當前頁面時,會出現這種情況:鼠標在地圖上滾動時,頁面也會滾動。怎么讓地圖動、頁面不動呢?代理基于jquery的mousewheel事件,組織事件冒泡。$('body').delegate('#allmap','mousewheel',function(){ console.log('map wheel'); return false;});
ok測試沒有問題。
This method is working in IE9+, Chrome 33, and Firefox 27.
$(window).bind('mousewheel DOMMouseScroll', function(event){
if (event.originalEvent.wheelDelta > 0 || event.originalEvent.detail < 0) {
// scroll up
alert("up");
}
else {
// scroll down
alert("down");
}
});