This article mainly introduces js to achieve vertical text scrolling and mouse hover effects, which has a certain reference value. Interested friends can refer to the examples in this article to introduce the vertical text scrolling effect, the setInterval (function () {}, time); method is used for your reference. The details are as follows:
HTML layout:
- Recommended 1 high-end community, classic apartment type, rare opportunity, transient! For only 0.66 million! 0.66 million 3 rooms, 2 halls, 1 bathroom, 120 ㎡
- Recommended 2 high-end communities, classic apartment type, rare opportunities, transient! For only 0.66 million! 0.66 million 3 rooms, 2 halls, 1 bathroom, 120 ㎡
- Recommend 3 high-end communities, classic apartment type, rare opportunities, transient! For only 0.66 million! 0.66 million 3 rooms, 2 halls, 1 bathroom, 120 ㎡
- Recommended 4 high-end communities, classic apartment type, rare opportunities, transient! For only 0.66 million! 0.66 million 3 rooms, 2 halls, 1 bathroom, 120 ㎡
CSS style:
JS script:
Script // continually append the first new one to the following function vscroll () {var frtEle = $ ('. recommend-info li: first '); frtEle. animate ({'margintop':-$ ('. recommend-info li '). height ()}, 500, function () {frtEle.css ('margintop ', 0); $ ('. recommend-info '). append (frtEle) ;});} var startInterval = setInterval (vscroll, 3000); // hover the cursor over $ ('. recommend-info li '). hover (function () {clearInterval (startInterval) ;}, function () {startInterval = setInterval (vscroll, 3000) ;}); script
The above is all the content of this article. Thank you for your attention!