Fancybox - how to scroll a page while focusing fancybox

go to: http://fancybox.net/ open any example (on the bottom page)

when the mouse freezes over the contents inside fancybox, the main browser window cannot be scrolled. when the mouse is somewhere else, it works. I do not want this behavior. how would you fix it?

page under scrolling fancybox modal doenst when mousecursor is inside fancyboxmodal.

+1
source share
8 answers

Check out the Fancybox source code and replace the code marked with the if ($.fn.mousewheel) {...}following text (Completely modified code can be found here ).

    if ($.fn.mousewheel) {
        wrap.bind('mousewheel.fb', function(e, delta) {
            if (!busy && $(e.target).get(0).clientHeight == 0 || $(e.target).get(0).scrollHeight === $(e.target).get(0).clientHeight) {
                // Remove the next line too, if you want weird movements
                // at the image gallery example...
                e.preventDefault();
                $.fancybox[ delta > 0 ? 'prev' : 'next']();
            }
        });
    }

Fancybox Fancybox- . , .

+3

, - $('# fancybox-wrap'). unbind ('mousewheel.fb'); .fancybox().

+7

, , , . fancybox - :

$('#fancybox-outer').mousewheel(function(event, delta) { 
  event.stopPropagation();
  $('#fancybox-wrap').trigger('mousewheel.fb', delta);
});

#fancybox-outer "" #fancybox-wrap.

, , mousewheel , .

+5

fancybox :

onComplete: function(){
  $("#fancybox-wrap").unbind('mousewheel.fb');
}

+2

,

. fancybox js. , , .

, , , , jQuery mousewheel, fancybox .

mousewheel ( fancybox), , , fancybox . , , .

+1

If you do not need to scroll through the images in the gallery with the mouse, then a good solution is to add $('#fancybox-wrap').unbind('mousewheel.fb');immediately after initialization .fancybox(), as indicated by vbulant

+1
source

Add the following plugin options:

helpers:  {
    overlay: {
      locked: false
    }
}

Thanks to pheonix for pointing this out to fooobar.com/questions/482946 / ...

0
source

for fancyBox - jQuery plugin version: 2.1.5

'afterShow': function () {
    $(".fancybox-wrap").unbind('mousewheel.fb');
},

'onComplete' dosen't work !!!

0
source

All Articles