jquery怎么实现滚动到元素后 给nav添加一个class
<divclass="wrap"><divclass="subMenu"><divclass="inner"><ahref="#"id="sTop"class="subN...
<div class="wrap">
<div class="subMenu" >
<div class="inner">
<a href="#" id="sTop" class="subNavBtn active">Home</a>
<a href="#" id="s1" class="subNavBtn">Section 1</a>
<a href="#" id="s2" class="subNavBtn">Section 2</a>
<a href="#" id="s3" class="subNavBtn">Section 3</a>
</div>
</div>
<div class="section sTop">
<div class="inner">
<h1>Welcome to the SMINT Demo page! </h1>
<p>Click the links below to see it in action!</p>
</div>
<br class="clear">
</div>
<div class="section s1">
<div class="inner">
<h1>Section 1</h1>
</div>
</div>
<div class="section s2">
<div class="inner">
<h1>Section 2</h1>
</div>
</div>
<div class="section s3">
<div class="inner">
<h1>Section 3</h1>
</div>
</div>
</div>
subMenu是固定在页面头部的
当页面滚动到section s1时 给ids1一个active 展开
<div class="subMenu" >
<div class="inner">
<a href="#" id="sTop" class="subNavBtn active">Home</a>
<a href="#" id="s1" class="subNavBtn">Section 1</a>
<a href="#" id="s2" class="subNavBtn">Section 2</a>
<a href="#" id="s3" class="subNavBtn">Section 3</a>
</div>
</div>
<div class="section sTop">
<div class="inner">
<h1>Welcome to the SMINT Demo page! </h1>
<p>Click the links below to see it in action!</p>
</div>
<br class="clear">
</div>
<div class="section s1">
<div class="inner">
<h1>Section 1</h1>
</div>
</div>
<div class="section s2">
<div class="inner">
<h1>Section 2</h1>
</div>
</div>
<div class="section s3">
<div class="inner">
<h1>Section 3</h1>
</div>
</div>
</div>
subMenu是固定在页面头部的
当页面滚动到section s1时 给ids1一个active 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询