方案1:當鼠標移入div時,設置body的overflow爲hidden,移出時候,設置overflo爲autoide
方案2:this
div.on("mousewheel", ".nav-menus", function (e) { $(this).scrollTop($(this).scrollTop() - e.originalEvent.wheelDelta); return false; });
參考代碼code
document.getElementById('side').onmousewheel = function(event) { if (!event) event = window.event; this.scrollTop = this.scrollTop - (event.wheelDelta ? event.wheelDelta : -event.detail * 10); return false; }
來源:v2eX @abelyaoget