javascript - Now the page will only be triggered once when it is opened. How can it be triggered multiple times?
扔个三星炸死你
扔个三星炸死你 2017-06-15 09:23:43
0
6
812
if(document.getElementById('heldnav').offsetTop < (188+$('#img_img').height())){
    alert(1)
  $("#heldnav").addClass("normal_0");
}
扔个三星炸死你
扔个三星炸死你

reply all(6)
我想大声告诉你

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.

滿天的星座

You should monitor scrolling, bind the scroll event to the element you want to monitor, and check the changes in real time

刘奇

Add to the corresponding event to monitor

淡淡烟草味

You need to add the corresponding scroll listening event to the floating object, and then do the judgment and processing in the method

左手右手慢动作

Either add timer setInterval/setTimeout or add event function to achieve real-time monitoring

伊谢尔伦

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?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template