Simple jquery site Announcement Progressive Carousel effect

Source: Internet
Author: User
Tags jquery library

CSS style:

<style>*{margin:0;padding:0;}Ul,li{List-style:None;}a{text-decoration:None;}img{Border:None;vertical-align:Top;}#notice{width:500px;Height:40px;position:relative;Overflow:Hidden;margin:50px Auto;Border:1px solid #CCC;}#notice ul{position:Absolute; Left:0;Top:0;}#notice ul Li{width:100%;Height:40px;Line-height:40px;text-indent:20px;}</style>
HTML structure:

<DivID= "notice"> <ul> <Li><ahref="#">Let it all be the water and the past</a></Li> <Li><ahref="#">Take that past as a hangover.</a></Li> <Li><ahref="#">Tomorrow's glass, no more than yesterday's sorrow</a></Li> </ul></Div>
JS code Implementation (need to import the jquery library file first):

functionMovetop (OBJ,NUM,TAG1,TAG2) {//Container element scrolling number of rows parent element child elementvarIH =$ (obj). Find (Tag2). Height (); $ (obj+TAG1). css (' height ', IH *$ (obj). Find (TAG2). length); $ (obj). Find (TAG1). Animate ({' Top ': ih*num},500,function(){ $( This). css ({top:0}). Find (' Tag2:first '). AppendTo ( This); });}varTimer =NULL; a timer= SetInterval (' Movetop (". Notice", 1, "ul", "Li") ', 3000); Automatic Carousel $ (". Notice"). Hover (function() {/////Stop auto-carousel (mouse Move-out events can also be implemented using MouseOver and mouseout) clearinterval (timer); },function() {Timer= SetInterval (' Movetop (". Notice", 1, "ul", "Li") ', 3000); Continue auto-carousel when mouse moves out);

Simple jquery site Announcement Progressive Carousel effect

Related Article

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.