fancybox2 / fancybox causes page to to jump to the top

sheriffderek picture sheriffderek · Nov 25, 2012 · Viewed 80.7k times · Source

I have implemented fancybox2 on a dev site.

When I engage the fancybox (click the link etc) the whole html shifts behind it - and goes to the top. I have it working fine in another demo, but when I drag the same code to this project it jumps to the top. Not only with the links to inline divs, but also for simple image gallery.

Has anyone experienced this?

Answer

Dave Kiss picture Dave Kiss · Mar 9, 2013

This can actually be done with a helper in Fancybox 2.

$('.image').fancybox({
  helpers: {
    overlay: {
      locked: false
    }
  }
});

http://davekiss.com/prevent-fancybox-from-jumping-to-the-top-of-the-page/