JQuery implements automatic list scrolling

Source: Internet
Author: User

You need to display News (announcements, activities, images, and so on) cyclically in a small area on the page. When you hover the mouse over the page, the scroll stops and the prompt is displayed. When you leave the page, the scroll continues.

:

Dry Loading

Html:

Aaaaaaaaaaaaaaa bbbbbbbbbbbbbbb ccccccccccccc ddddddddddddddd eeeeeeeeeeeeeee fffffffffffffff ggggggggggggggg

Css:

{:;}{:;:;}

The key is the js file:

$ ($ = $ ("# News ". hover (= setInterval (2000 "mouseleave" $ self = obj. find ("ul" lineHeight = $ self. find ("li: first" "marginTop":-lineHeight + "px" 600, 0 "li: first"

It mainly involves understanding and using hover, setInterval, clearInterval, animate, And the marginTop attributes (marginLeft, top, left, and so on). Note that if this attribute is not added. trigger ("mouseleave"), the list does not scroll during page initialization, and appendTo can directly move elements.

 

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.