how to prevent scrolling of page behind fancybox-2

前端 未结 9 1939
北恋
北恋 2020-12-16 14:44

We are using fancybox2 for displaying images. Everything works well, but when the larger image is displayed in the fancybox, the page behind scrolls to the top. After closin

9条回答
  •  一向
    一向 (楼主)
    2020-12-16 14:53

    Apparently, Fancybox changes the CSS property overflow on body element to hidden when a picture is showed. This causes the background to scroll back to the top. All you have to do is comment out the row saying overflow: hidden !important; in section .fancybox-lock in stylesheet jquery.fancybox.css.

    Please see fancybox2 / fancybox causes page to to jump to the top as well.

提交回复
热议问题