Friday, July 3, 2015

Mousewheel event not working in safari within iframe

Hi,

So a new strange issue that went live, while implementing a iframe window with a mousewheel handler stopped working in safari (mac).
And it was very strange because it was working on webkit browsers (like chrome) and other browsers perfectly fine.

And to be precise, was using https://github.com/jquery/jquery-mousewheel it says

"A jQuery plugin that adds cross-browser mouse wheel support with delta normalization."

then why it is not working in safari for me.

Then collected my thoughts and found that it is working as such in safari but completely switching off when served inside an iframe in safari, so googled a bit and found https://bugs.webkit.org/show_bug.cgi?id=124139 which is kind of an open debate/bug whether it should work or not but in a nutshell the things that made it work was



onmousehweel=""

yes as such this piece of code does nothing significant but somehow it passes scroll event from main window to pertaining iframe (in safari) and it make is work :)

there is one more solution and that is to

Open the Safari dev tools and run the following code:
  var f = function() {};
  document.addEventListener("mousewheel", f);
  document.removeEventListener("mousewheel", f);

But haven't given that a try

1 comment:

Sky diving! What it feels like.

Writing a new post after almost a year :) Penning it down here.. so that can relive that moment when i did the jump from 10000 feet up in...