Karl
Karl

Reputation: 1854

FancyBox scrolling parent page's content too

Using FancyBox v2.0.6 with or without the mousewheel plugin. If the user opens FancyBox, scrolls to the end of the content and then continues scrolling, the parent page will then scroll.

This can be disconcerting, for when the user closes FancyBox, they are not at the same location on the parent page.

Is there a way to stop the parent page from scrolling when FancyBox is open?

Upvotes: 0

Views: 2356

Answers (1)

JFK
JFK

Reputation: 41143

You may try adding these fancybox options to your custom script

beforeLoad: function(){
 $("body").css({"overflow-y":"hidden"});
},
afterClose: function(){
 $("body").css({"overflow-y":"visible"});
}

... so basically it stops the vertical scrolling on the parent page while fancybox is open.

Upvotes: 3

Related Questions