Search code examples
jqueryfancybox

How can I enable scrolling of the parent document while fancybox is opened?


I want a fancybox to appear, but still be able to scroll up and down on the parent page.

Is there a way to do that?

My Fancybox definition:

// Fancy box to appear when user scrolls below video
            $(".fancybox").fancybox({
                autoSize:false,
                modal:false,
                width:400,
                height:'auto',
            });

Solution

  • You would need to set as CSS rules to overwrite fancybox's ones:

    html.fancybox-lock, html.fancybox-lock body {
        overflow: visible !important;
    }
    
    html.fancybox-lock body .fancybox-overlay{
        overflow: hidden !important;
    }