JS picture Seamless, Smooth scrolling code

Source: Internet
Author: User
Tags setinterval

  This article mainly introduces the JS picture seamless, smooth scrolling implementation, the need for friends can refer to the following

Very smooth JS picture scrolling effect code, seamless loop, speed can be customized, mouse hover stop. It is characterized by JS and picture address separation, so you will be easy to dynamically from the database to call the address of each picture, convenient control, so it is very applicable.     Code as follows: <! 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> picture rolling </title>  </head>  <body>  <style Type= "Text/css" >  <!--  #demo {  background: #FFF;  overflow:hidden;  border:1px Dashed #CCC;  width:500px; }  #demo img {  border:3px solid #F2F2F2; }  #indemo {  float: left;  width:800%; }  #demo1 {  float:left; }  #demo2 {  float:left; }  -->  </style>  <div id= "Demo" >  <div id= "Indemo" >  <div id= "Demo1" >   <a href= "#" ><imgSrc= "/jscss/demoimg/wall_s1.jpg" border= "0"/></a>  <a href= "#" ><img src= "/jscss/demoimg/ Wall_s2.jpg "border=" 0 "/></a>  <a href=" # "><img src="/jscss/demoimg/wall_s3.jpg "border=" 0 "/ ></a>  <a href= "#" ><img src= "/jscss/demoimg/wall_s4.jpg" border= "0"/></a>  <a href= "#" ><img src= "/jscss/demoimg/wall_s5.jpg" border= "0"/></a>  <a "#" >< IMG src= "/jscss/demoimg/wall_s6.jpg" border= "0"/></a>  </div>  <div id= "Demo2" ></ div>  </div>  </div>  <script>  <!--  var speed=10;  var tab= document.getElementById ("demo");  var Tab1=document.getelementbyid ("Demo1");  var tab2= document.getElementById ("Demo2");  tab2.innerhtml=tab1.innerhtml;  function Marquee () {  if ( tab2.offsetwidth-tab.scrollleft<=0)   tab.scrollleft-=tab1.offsetwidth  else{  Tab.scrollLeft++; } }  var mymar=setinterval marquee,speed;  () {tab.onmouseover=function ( MyMar)};  tab.onmouseout=function () {mymar=setinterval (marquee,speed)}; -->  </script>   </body>  </html>   

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.