Search code examples
jqueryuser-interfacefancybox

jQuery UI and fancybox issue: Jumps to top after open fancybox


I got an issue between jQuery UI accordion and the latest fancybox. After clicking a fancybox linked image in the accordion the script jumps always to the top of my site. The only option I set for accordion is heightStyle: "content". I have no idea where the issue could be.


Solution

  • The problem is that fancyBox changes the overflow value of the body in order to hide the browser scrollbars. This can actually be done with a helper in Fancybox 2.

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