我想在此脚本的jquery中将document
更改为id
$(document).on("scroll",function(){
if($(document).scrollTop()>100){
$("#brand1h1").removeClass("screen_block_title").addClass("screen_block_title2");
} else {
$("#brand1h1").removeClass("screen_block_title2").addClass("screen_block_title");
}
});
我想改变不在页面滚动,我想在页面中间的特定id
答案 0 :(得分:-1)
我认为你正在寻找这样的事情,如果没有,请告诉我。
$("#d").on("scroll",function(){
if(1==1){ //CHANGE IF CONDITION AS NEEDED
alert("Scrolled");
} else {
//ELSE CODE HERE
}
});

#d
{
height:40px;
overflow-y:scroll;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<DIV id="d">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
&#13;