HTML Announcement Scrolling __html

Source: Internet
Author: User
<div id= "News" > 
<ul> 
<li><a href= "#" title= "AAAAAAAAAAAAAAA" >aaaaaaaaaaaaaaa</ a></li> 
<li><a href= "#" title= "BBBBBBBBBBBBBBB" >bbbbbbbbbbbbbbb</a></li> 
<li><a href= "#" title= "CCCCCCCCCCCCCCC" >ccccccccccccccc</a></li> 
<li>< A href= "#" title= "ddddddddddddddd" >ddddddddddddddd</a></li> 
<li><a href= "#" title= " Eeeeeeeeeeeeeee ">eeeeeeeeeeeeeee</a></li> 
<li><a href=" # "title=" FFFFFFFFFFFFFFF " >fffffffffffffff</a></li> 
<li><a href= "#" title= "GGGGGGGGGGGGGGG" >ggggggggggggggg </a></li> 
</ul> 

Ui,li { 
list-style:none; 
} 
#news { 
height:75px; 
Overflow:hidden; 

$ (function () { 
var $this = $ ("#news"); 
var Scrolltimer; 
$this. Hover (function () { 
clearinterval (scrolltimer); 
}, Function () { 
Scrolltimer = setinterval (function () { 
scrollnews ($this); 
};} 
). Trigger ("MouseLeave"); 

function Scrollnews (obj) { 
var $self = obj.find ("ul"); 
var lineheight = $self. Find ("Li:first"). Height (); 
$self. Animate ({ 
"margintop":-lineheight + "px" 
}, and function () { 
$self. css ({ 
margintop:0 
}). Find ("Li:first"). Appendto ($self); 
}) 
} 
The main is to hover, setinterval, clearinterval, animate these methods as well as margintop attributes (MarginLeft, top, left, etc.) understanding and application, need to pay attention to, if not add. Trigger ("MouseLeave"), the list does not scroll when the page is initialized, and appendto can move elements directly, that's all.

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.