The code is as follows:
$(window).scroll(function() {
var scrolls = $(this).scrollTop();
$(".context_block").each(function(){ //Block-level element with class name "context_block"
var height = $(this).height();
If($(this).position().top height-60> scrolls){
var _index = $(".context_block").index($(this));
through
$($(".menu a")[_index]).addClass("hover_mobileLink");//Dynamically change the style of the a tag under the block-level element with class "menu" (add or delete a class)
return false;
}
});
});
The core code is very simple, but the implementation effect is very good. I recommend it to my friends here.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn