<script src="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.9.4/jquery.fullpage.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.9.4/jquery.fullpage.extensions.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.9.4/jquery.fullpage.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<header>
<div class="header-top clearfix">
<a href="getinvolved.html" class="pull-right btn btn-danger btn-round donate">DONATE NOW</a>
<img src="img/logo.png" class="img-responsive" />
<a class="l-right toggle-menu" href="#" id="pop">
<span class="icon-menu" ></span>
</a>
</div>
<div class="menu-overlay">
<div class="menu-body">
<a href="#"><span class="closer" onclick="closeNav()"><i class="icon-close icons"></i></span></a>
<ul class="menu-pan">
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About Us</a></li>
<li><a href="whatwedo.html">What We Do</a></li>
<li><a href="getinvolved.html">Get Involved</a></li>
<li><a href="contactus.html">Contact Us</a></li>
</ul>
</div>
</div>
</header>
<div id="fullpage">
<section class="vertical-scrolling" id="section1">
</section>
<section class="vertical-scrolling" id="section2">
</section>
<section class="vertical-scrolling" id="section2">
</section>
<section class="vertical-scrolling" id="section3">
</section>
<section class="vertical-scrolling" id="section4">
</section>
<section class="vertical-scrolling" id="section5">
</section>
</div>
&#13;
答案 0 :(得分:0)
试试这个:
var top1 = $('#section1').offset().top;
var top2 = $('#section2').offset().top;
var top3 = $('#section3').offset().top;
var top4 = $('#section4').offset().top;
var top5 = $('#section5').offset().top;
$(document).scroll(function() {
var scrollPos = $(document).scrollTop();
if (scrollPos >= top1 && scrollPos < top2) {
$('#change').css('background-color', '#f00');
} else if (scrollPos >= top2 && scrollPos < top3) {
$('#change').css('background-color', '#0f0');
} else if (scrollPos >= top3 && scrollPos < top4) {
$('#change').css('background-color', '#00f');
} else if (scrollPos >= top4 && scrollPos < top5) {
$('#change').css('background-color', '#000');
}else if (scrollPos >= top5) {
$('#change').css('background-color', '#ff0000');
}
});
body {
margin: 0;
padding-top: 30px
}
header {
position: fixed;
top: 0;
width: 100%;
height: 30px;
background-color: #000;
}
ul{
list-style-type:none;
padding: 0px;
margin: 0px;
}
ul li{
display: inline-block;
padding: 5px;
}
section {
height: 500px;
background-color: #aaa;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<header id="change">
<div class="container">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About Us</a></li>
<li><a href="whatwedo.html">What We Do</a></li>
<li><a href="getinvolved.html">Get Involved</a></li>
<li><a href="contactus.html">Contact Us</a></li>
</ul>
</div>
</header>
<section id="section1">Content</section>
<section id="section2">Content</section>
<section id="section3">Content</section>
<section id="section4">Content</section>
<section id="section5">Content</section>
根据您的需要更改内容和Css。