0
votes

Basically the page runs a swf game. Need to disable the mousewheel function if the cursor is inside the game.

This is what I tried

jQuery(document).ready(function(){
  jQuery('#gameplay-container').mouseenter(function(){
    document.onmousewheel = function(){
      return false
    }
  });
  jQuery('#gameplay-container').mouseout(function(){
    document.onmousewheel = function() {
      return true;
    }
  });
});

doesn't seem to work at all. I did find a way to disable the scrolling when you hovered over a div, but once the flash object loaded it stopped functioning. Flash wmode is set to transparent but have tried opaque as well. #gameplay-container is the div that contains the flash object.

2

2 Answers

0
votes

use event.preventDefault() and return false;

function(event) { event.preventDefault(); return false; }
0
votes

try going directly to the mousewheel functionality:

 $("#gameplay-container").bind("mousewheel", function() {
         return false;
     });