我想在滚动时更改ul样式并使用jQuery到达div,解释下来。
CSS:
#menu {
background-color:#ccc;
position:fixed;
width:100%;
}
.menutext {
padding:25 40 30 !important;
display:inline-block;
}
.menutext2 {
padding:25 40 0 !important;
display:inline-block;
color:red;
}
.alldivs {
width:300px;
height:200px;
background-color:a9a9a9;
}
HTML code:
<div id="menu">
<div class="menutext">Change the style of me to .mebutext2 on arriving to DIV1</div>
<div class="menutext">Change the style of me to .mebutext2 on arriving to DIV2</div>
<div class="menutext">Change the style of me to .mebutext2 on arriving to DIV3</div>
</div>
<br><br><br>
<div class="alldivs"><div id="DIV1">DIV1</div></div>
<br><br><br><br>
<div class="alldivs"><div id="DIV2">DIV2</div></div>
<br><br><br><br>
<div class="alldivs"><div id="DIV3">DIV3</div></div>
<br><br><br><br>
我想在滚动时将类“menutext”更改为类“menutext2”,并且到达div的顶部(第一个ul的类从menutext1更改为menutext2,到达具有id DIV1的div,第二个ul的类更改从menytext1到menutext2到达具有id DIV2的div并且第一个ul的类返回menutext1 AS IT WAS等等。