Jquery - Fancybox - Background Page Shift Issue

后端 未结 13 1446
后悔当初
后悔当初 2021-02-02 00:31

Fancybox is loading well and everything opens as I want it to, but the issue occurs in the background-- it\'s visible (and disturbing) that my entire page shifts exactly 8 pixel

13条回答
  •  無奈伤痛
    2021-02-02 01:00

    I had a very similar situation recently with Fancybox v2. My initial page had content below the fold and therefore had a scrollbar (perhaps the OP did as well, it's not clear). Firing the Fancybox link caused the same shift in page body and clearing the scrollbar; closing the Fancybox image shifted the body back and re-enabled the scrollbar.

    The adjustments to .fancybox-lock did not work for me but what did was including the following option when instantiating my Fancybox object:

    helpers: { 
        overlay: { 
            locked: false 
        } 
    }
    

    The only caveat is this does not lock your Fancybox to the center of the page if you had scrolling, i.e. the page with Fancybox view is entirely scrollable. For me, it was the lesser of two evils.

提交回复
热议问题