Javascript 当光标进入swf对象时需要禁用鼠标滚轮
基本上,页面运行swf游戏。如果光标在游戏中,则需要禁用鼠标滚轮功能 这就是我试过的Javascript 当光标进入swf对象时需要禁用鼠标滚轮,javascript,jquery,flash,mousewheel,Javascript,Jquery,Flash,Mousewheel,基本上,页面运行swf游戏。如果光标在游戏中,则需要禁用鼠标滚轮功能 这就是我试过的 jQuery(document).ready(function(){ jQuery('#gameplay-container').mouseenter(function(){ document.onmousewheel = function(){ return false } }); jQuery('#gameplay-container').mouseout(funct
jQuery(document).ready(function(){
jQuery('#gameplay-container').mouseenter(function(){
document.onmousewheel = function(){
return false
}
});
jQuery('#gameplay-container').mouseout(function(){
document.onmousewheel = function() {
return true;
}
});
});
似乎根本不起作用。当你把鼠标悬停在div上时,我确实找到了一种禁用滚动的方法,但是一旦flash对象加载,它就停止工作了。Flash wmode设置为透明,但也尝试过不透明#gameplay container是包含flash对象的div。使用
event.preventDefault()
和返回false代码>
function(event) { event.preventDefault(); return false; }
尝试直接转到鼠标滚轮功能:
$("#gameplay-container").bind("mousewheel", function() {
return false;
});