Fancybox 2 scrollbar disapears and site shifts to the right

梦想的初衷 提交于 2019-12-09 04:39:27

As far as I can tell, you modified the original fancybox css file.

You changed the line 167 from this

.fancybox-lock {
    overflow: hidden;
}

into this

.fancybox-lock {
    overflow: hidden;
    margin-right:0 !important;
}

... and the line 187 from this

.fancybox-lock .fancybox-overlay {
    overflow: auto;
    overflow-y: scroll;
}

into this

.fancybox-lock .fancybox-overlay {
    overflow: hidden;
    overflow-y: hidden;
}

... so no wonders (bear in mind that the js file also changes some css properties dynamically so you may not have full control just changing the css file)

Generally speaking you shouldn't mess with the original files unless you are pretty sure what you are doing, otherwise you will have unexpected results

I've solved this problem by adding the following code in the main CSS file:

body { margin: 0 !important; }
.fancybox-lock,
.fancybox-overlay { overflow: visible !important; }

I had the same issue... scrollbar disappeared and page shifted to the right. Annoying, but this code indeed works. Just add it to any of your fancybox css file (or any included css file for that matter).

.fancybox-lock, .fancybox-overlay { overflow: visible !important;}  

Force the page to always scroll with:

body {overflow-y: auto !important;}

I had this problem and my solution was easier than I expected it to be. I simply went into the html and noticed I'd had two body's

In the code (near the bottom) there is the following:

    body {
        max-width: 700px;
        margin: 0 auto;
    }

I deleted that and my website now went back to being centred.

added:

.fancybox-lock, .fancybox-overlay { overflow: visible !important;}
body {overflow: visible !important;}

removed:

.fancybox-lock body { overflow: hidden !important;}

fine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!