if(document.getElementById('heldnav').offsetTop < (188+$('#img_img').height())){
alert(1)
$("#heldnav").addClass("normal_0");
}
我想大声告诉你2017-06-15 09:25:43
Are you listening to some floating nav? You should first determine in what state you want to trigger this listener, such as a change in browser window size or something else, and then write your code in the corresponding event, such as resize, etc.
滿天的星座2017-06-15 09:25:43
You should monitor scrolling, bind the scroll event to the element you want to monitor, and check the changes in real time
淡淡烟草味2017-06-15 09:25:43
You need to add the corresponding scroll listening event to the floating object, and then do the judgment and processing in the method
ringa_lee2017-06-15 09:25:43
Either add timer setInterval/setTimeout or add event function to achieve real-time monitoring
伊谢尔伦2017-06-15 09:25:43
Either a timer or add an event listener. It depends on your needs. In short, it's impossible to just write a method and let it execute multiple times by itself, right?