我正在使用 fullpage.js 并尝试将图像背景添加到我的一张幻灯片中,但是当我这样做时,页面会自行“跳过”一个部分。 我当前的部分 CSS 如下:
#slide1{background-image: url(https://github.com/antonettis/fullpage/raw/gh-pages/img/chess.jpg); background-repeat: no-repeat; background-size: auto 100%; }
我将它与 fullpage.js 演示进行了比较,如果我复制它,我的代码应该是这样的:
#slide1{background-image: url(https://github.com/antonettis/fullpage/raw/gh-pages/img/chess.jpg); background-size: cover; background-attachment: fixed; }
但是,当我这样做时,图像完全消失了。 Here is the codepen .图片位于第 4 页,幻灯片 1。在此先感谢您的帮助。
最佳答案
您需要将 css 代码替换为:
.fp-section{
background-image: url(https://github.com/antonettis/fullpage/raw/gh-pages/img/chess.jpg);
background-repeat: no-repeat;
background-size: auto 100%;
}
关于javascript - 图像背景和 Fullpage.js 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45401818/