Jquery simple and practical seamless scrolling Effect
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.bKjia. c0m/1999/xhtml">
<Head>
<Title> simple and practical seamless rolling effect </title>
<Meta http-equiv = "content-type" content = "text/html; charset = gb2312">
<! -- Add the following code between <Style type = "text/css tutorial">
* {Font-size: 12px ;}
# Mydiv ul {height: 180px; overflow: hidden; margin: 20px; background: # eee; width: 300px}
# Mydiv ul li {height: 25px; line-height: 25px ;}
</Style>
<Script src = "http://www.google.com/jsapi"> </script>
<Script language = "javascript tutorial">
Google. load ("jquery", "1.3.1 ");
Google. setOnLoadCallback (OnLoad );
Function OnLoad (){
Function giveInterval (funcName, time) {var args = []; for (var I = 2; I <arguments. length; I ++) {args. push (arguments [I]);} return window. setInterval (function () {funcName. apply (this, args) ;}, time );}
Function marquee (elem ){
If (! Elem. cloned ){
Elem.html(elem.html()+elem.html ());
Elem. cloned = 1;
Elem. Stop = "go ";
Elem. hover (function () {elem. Stop = "stop" ;}, function () {elem. Stop = "go "})
Elem. pause = 0;
}
Var scrtop = elem. attr ("scrollTop ");
If (elem. pause! = 0 ){
Elem. pause --;
Return;
}
If (scrtop) % 100 = 0 ){
Elem. pause = 100;
}
If (elem. Stop = "stop") return
Scrtop ++;
Elem. attr ("scrollTop", scrtop );
If (elem. attr ("scrollTop")> = elem. attr ("scrollHeight")/2 ){
Elem. attr ("scrollTop", 0 );
Scrtop = 0;
}
}
GiveInterval (marquee, 10, jQuery ("# mydiv ul "));
}
</Script>
</Head>
<Body>
An error is prompted in the lower left corner of the preview result, and the effect is invisible. Refresh the page to see the effect. Of course, this problem does not occur in actual use. <Br>
<! -- Add the following code to the <body> and </body> -->
<Div class = "marquee & step = 1 & delay = 10" id = "mydiv">
<Ul>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "WEB "href = "#"> start: www. bKjia. c0m </a> </li>
<Li> <a rel = "bookmark" title = "China WEB First stop" href = "#"> start: www. bKjia. c0m </a> </li> </ul>
</Div>
</Body>
</Html>