gpt4 book ai didi

html - Fullpage.js 背景图片

转载 作者:太空狗 更新时间:2023-10-29 14:08:27 29 4
gpt4 key购买 nike

我刚刚开始使用 fullpage.js 库(?),想知道如何将背景图像添加到部分。我尝试在该部分中添加一个新的 div 并向该部分添加一个新类,但无济于事。请帮忙!

HTML

<div class="section bg" id="section0"><h1>Section</h1></div>
<div class="section" id="section1">
<div class="slide active"><div class="wrap"><h1>Hello fullPage.js</h1></div></div>
<div class="slide"><h1>This is an awesome plugin</h1></div>
<div class="slide"><h1>Which enables you to create awesome websites</h1></div>
<div class="slide"><h1>In the most simple way ever</h1></div>
</div>
<div class="section" id="section2"><h1>Just testing it</h1></div>
<div class="section" id="section3"><h1>Looks good</h1></div>


</body>

CSS(我在标准之上的自定义 CSS)

.bg {
background: url(../img/Blurred%20Backgrounds%20(13).jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

最佳答案

您需要为此使用 CSS。为每个部分使用 id 并为其添加相应的样式。

已经在github issues上进行了处理: https://github.com/alvarotrigo/fullPage.js/issues/6

这里有官方演示或者它: http://alvarotrigo.com/fullPage/examples/backgrounds.html#

(在页面源码中可以看到CSS样式)

/* Backgrounds will cover all the section
* --------------------------------------- */
#section0,
#section1,
#section2,
#section3{
background-size: cover;
}

/* Defining each sectino background and styles
* --------------------------------------- */
#section0{
background-image: url(imgs/bg1.jpg);
padding: 30% 0 0 0;
}
#section2{
background-image: url(imgs/bg3.jpg);
padding: 6% 0 0 0;
}
#section3{
background-image: url(imgs/bg4.jpg);
padding: 6% 0 0 0;
}
#section3 h1{
color: #000;
}


/*Adding background for the slides
* --------------------------------------- */
#slide1{
background-image: url(imgs/bg2.jpg);
padding: 6% 0 0 0;
}
#slide2{
background-image: url(imgs/bg5.jpg);
padding: 6% 0 0 0;
}

关于html - Fullpage.js 背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20108435/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com