jquery-based up and down seamless scrolling application (single or multiple lines)

Source: Internet
Author: User

 $ (function () {    var _wrap=$ (' Ul.line ');//define scrolling area     VAR _interval=2000;//define rolling Gap time     VAR _moving;//need to clear the animation     _wrap.hover (function () {        clearinterval (_moving) ;//When the mouse is in the scrolling area, stop scrolling    },function () {        _moving=setinterval (function () {             var _field=_wrap.find (' Li:first ');//This variable cannot be placed at the beginning of the function, Li: The first value is the change             var _h=_field.height ();//The variable cannot be placed at the beginning of each scroll height (multi-line scrolling) , otherwise there will be interval time delay)             _field.animate ({margintop:-_h+ ' px '},600,function () {//By taking a negative margin value, hide the first line                 _field.css (' margintop ', 0). AppendTo (_wrap);//hide the margin value of the line and insert it into the end, to achieve seamless scrolling             })         },_interval)//scrolling interval depends on _interval   }). Trigger (' MouseleAve ');//When the function is loaded, the simulation executes mouseleave, i.e. automatic scrolling}); 

JQuery -based, up and down seamless scrolling application can be applied to multiple lines or single lines. Please refer to the comments for details.



View Demo:
Click here to view demo

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.