Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 当光标进入swf对象时需要禁用鼠标滚轮_Javascript_Jquery_Flash_Mousewheel - Fatal编程技术网

Javascript 当光标进入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

基本上,页面运行swf游戏。如果光标在游戏中,则需要禁用鼠标滚轮功能

这就是我试过的

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;
     });