Js scroll up seamlessly, website Announcement Effect

Source: Internet
Author: User

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> untitled document </title>
<Style type = "text/css">
<!
-- # Demo
{
Overflow: hidden;
Width: 220px;
Float: left;
Display: inline;
}
# Demo ul
{
Text-align: left;
Margin: 0px;
Padding: 0px;
Width: 220px;
}
# Demo ul li
{
Margin-left: 5px;
Display: block;
List-style: none;
Font-size: 13px;
Height: 26px;
Padding-top: 5px;
}
--> </Style>
</Head>
<Body>

// The height here is style = "height: 26px. If you are not sure about this, you need to customize the input. Otherwise, if the definition is high and the li in ul does not reach this height, scrolling will fail.
<Div id = "demo" style = "height: 26px;">
<Div id = "demo1">
<Ul>
<Li> · <a href = "http://www.bkjia.com/"> era front-end 1 </a> </li>
<Li> · <a href = "http://www.bkjia.com"> era front-end 2 </a> </li>
<Li> · <a href = "http://www.bkjia.com //"> front end 3 </a> </li>
<Li> · <a href = "http://www.bkjia.com //"> front-end 4 </a> </li>
</Ul>
</Div>
<Div id = "demo2">
</Div>

<Script type = "text/javascript">
// Uninterrupted text scrolling code, compatible with IE, Firefox, and Opera
Var speed = 60;
Var FGDemo = document. getElementById ('Demo ');
Var FGDemo1 = document. getElementById ('demo1 ');
Var FGDemo2 = document. getElementById ('demo2 ');
FGDemo2.innerHTML = FGDemo1.innerHTML
Function Marquee1 (){
If (FGDemo2.offsetHeight-FGDemo. scrollTop <= 0)
FGDemo. scrollTop-= FGDemo1.offsetHeight
Else {
FGDemo. scrollTop ++
}
}

Var MyMar1 = setInterval (Marquee1, speed)
FGDemo. onmouseover = function () {clearInterval (MyMar1 )}
FGDemo. onmouseout = function () {MyMar1 = setInterval (Marquee1, speed )}
</Script>

</Div>
</Body>
</Html>

 

 

From colyn

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.