Js +div image scroll effect code

  • 2020-03-30 01:37:45
  • OfStack

The transverse
< Div id = demo style = "overflow: hidden; Width: 200 px; Border: # 2 px solid e0e0e0; Padding: 2 px;" Onmouseover = "stopscroll ();"

Onmouseout = "doscroll ()" >
< Div id = "not" style = "white - space: nowrap; Padding: 0;" >
< A href="javascript:alert(' post new post ');" > < Img SRC =" image URL" height=20 width=104

Border = 0 > < / a>
< A href="javascript:alert(' publish reply ');" > < Img SRC =" image URL" height=20 width=104

Border = 0 > < / a>
< / div>
< / div>
< ! -- scrolling javascript-->
< Script>
Var t = demo. ScrollWidth
Not. The innerHTML + = not. InnerHTML
The function doMarquee ()
{
The demo. ScrollLeft = demo. ScrollLeft< The demo. ScrollWidth - demo. OffsetWidth? Demo. ScrollLeft + 1: t - demo. The offsetWidth
}
The function doscroll ()
{
    Sc = setInterval (20) doMarquee,
}
The function stopscroll ()
{
    ClearInterval (sc)
}
Doscroll ()
< / script>
< ! -- end of scrolling javascript -->


The longitudinal
< Div id = "demo" style = "height: 110 px; Overflow: hidden ">
< Div id = "not" >
< A href="javascript:alert(' post new post ');" > < Img SRC =" image URL" height=20 width=104

Border = 0 > < / a>
< A href="javascript:alert(' publish reply ');" > < Img SRC =" image URL" height=20 width=104

Border = 0 > < / a>
< / div> < Div id = "demo2" > < / div>
< ! -- scrolling javascript-->
< Script>
Var speed = 100
Demo2. InnerHTML = not. InnerHTML
The function Marquees () {
If (demo2 offsetTop - demo. ScrollTop< = 0)
The demo. ScrollTop - = not. OffsetHeight
The else {
The demo. ScrollTop++
}
}
Var MyMars = setInterval (Marquees, speed)
Demo. Onmouseover = function () {clearInterval (MyMars)}
The demo. Onmouseout = function () {MyMars = setInterval (Marquees, speed)}
Zlselect (' 6 ');
< / script> < ! -- end of scrolling javascript -->
< / div>


Related articles: