Seamless scrolling of jQuery classic code (favorites), seamless jquery

Source: Internet
Author: User

Seamless scrolling of jQuery classic code (favorites), seamless jquery

<Script language = "javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"> </script>

<Style type = "text/css"> img {border: none ;}</style>

<Div id = "demo">

<Table border = "0" align = "center" cellpadding = "1" cellspacing = "1" cellspace = "0">

<Tr>

<Td id = "demo1" valign = "top" bgcolor = "ffffff">

<! -- Note that the total width of the image below must be greater than the width of the demo defined above. For example, if the width of the demo above is 500 PX, the total width of the image below must be greater, otherwise, some problems may occur! -->

<Table border = "0" cellspacing = "0" cellpadding = "0">

<Tr align = "center">

<Td>

<A href = "#" target = "_ blank"> </a>

</Td>

<Td>

<A href = "#" target = "_ blank"> </a>

</Td>

<Td>

<A href = "#" target = "_ blank"> </a>

</Td>

<Td>

<A href = "#" target = "_ blank"> </a>

</Td>

<Td>

<A href = "#" target = "_ blank"> </a>

</Td>

</Tr>

</Table>

</Td>

<Td id = "demo2" valign = "top"> </td>

</Tr>

</Table>

</Div>

<Script type = "text/javascript"> var speed = 30; var demo = $ ("# demo"); var demo1 = $ ("# demo1 "); var demo2 = $ ("# demo2 ");

Demo2.html(demo1.html ());

Function Marquee () {if (demo. scrollLeft ()> = demo1.width () demo. scrollLeft (0); else {demo. scrollLeft (demo. scrollLeft () + 1 );}}

Var MyMar = setInterval (Marquee, speed)

Demo. mouseover (function () {clearInterval (MyMar);}) demo. mouseout (function () {MyMar = setInterval (Marquee, speed );})

</Script>


This seamless scrolling code. If a page is called multiple times, what should I change?

Function addEventSimple (obj, evt, fn ){
If (obj. addEventListener ){
Obj. addEventListener (evt, fn, false );
} Else if (obj. attachEvent ){
Obj. attachEvent ('on' + evt, fn );
}
}
AddEventSimple (window, 'load', initScrolling );
The code is initialized and the initScrolling function is actually executed.
The initScrolling function operates on scrollText nodes:
Function initScrolling (){
ScrollingBox = document. getElementById ("scrollText ");

// Style settings, which are basically irrelevant to scrolling. CSS settings should be used.
ScrollingBox. style. height = "250px ";
ScrollingBox. style. overflow = "hidden ";

// Scroll
ScrollingInterval = setInterval ("scrolling ()", 40 );
// Click the mouse to stop the scroll Effect
ScrollingBox. onmouseover = over;
// Scroll out with the cursor
ScrollingBox. onmouseout = out;
}
If you know the call relationship, how can you change it?

Seamless scrolling of Jquery text to the left-like Sina meager Unlogged-on home page is hot and rolling answers

It is nothing more than DOMAttrModified and DOMSubtreeModified.
Adjust the left value of ul's position in real time. The first li is completely hidden and then moved to the end of ul.
 

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.