The example in this article describes the method of using Jquery to achieve the effect of subway line indicator lights. Share it with everyone for your reference. The specific analysis is as follows:
Friends who often take the subway must have observed that when the subway is running, the green indicator light keeps going back and forth from one direction to the other, and it does not stop until it reaches the station. I have always wanted to do this. Such effect. After careful consideration today, I finally got a clue, and it has produced some results. Although there are still areas for optimization, I will post the code first. However, there is something wrong with the code in the comment. When the last index is reached, the color is added again at index 0, but it does not start from index 0 after the second execution. Interested friends can improve it.
I hope this article will be helpful to everyone’s jQuery programming.