go to: http://fancybox.net/ open any example (on bottom page)
when the mouse is hovered over the content inside the fancybox, the browser main window can´t be scrolled. when the mouse is anywhere else it works. i dont want this behavior. how would you fix this?
the page under the fancybox modal doenst scroll, when the mousecursor is inside the fancyboxmodal.
Marcel,
Don't get complicated. You don't have to mess with the fancybox js file at all. The function mentioned above has a purpose.
The reason the page behaves the way you described, is because it has loaded the jQuery mousewheel plugin, which is used to navigate through galleries inside fancybox using the mouse wheel.
If you don't load the mousewheel plugin (included with the download of fancybox), then you could scroll the parent page regardless you hover inside the content of fancybox or not. Of course, if you have galleries, then you have to use the arrows to navigate through them.
for fancyBox - jQuery Plugin version: 2.1.5
'onComplete' dosen't work!!!
Indeed the bit of code Rob mentioned is the culprit. But instead of changing fancybox itself you can do something like this:
This would catch the wheel event on
#fancybox-outer
, and prevent the event from bubbling up to#fancybox-wrap
.So the default behaviour of scrolling will take place, but you can also trigger the blocked mousewheel event handler manually like I did.
In the fancybox options, you can do:
and then you can do mouse scroll in any box with overflow
Look in the source code of Fancybox, and replace the code marked by
if ($.fn.mousewheel) {...}
with the following (The fullly modified code can be found here).The creators of Fancybox disabled scrolling on Fancybox elements, without adding an option to customise this. Hence you have to manually edit the code.
Well, the simplest solution is to add $('#fancybox-wrap').unbind('mousewheel.fb'); just after .fancybox() initialization.