JS simple to achieve seamless scrolling effect example _javascript skills

Source: Internet
Author: User

This article is an example of JS simple to achieve seamless scrolling effect. Share to everyone for your reference, specific as follows:

<!doctype html> <title>javascript Seamless scrolling </title> <meta charset= "Utf-8"/> <meta name= " Keywords "content=" javascript seamless scrolling "/> <meta name=" description "content=" JavaScript seamless scrolling "/> <style type=" 
    Text/css "> H1 {font:400 16px/1" Microsoft Yahei, kaiti_gb2312, SimSun} #marquee {position:relative;
    width:400px;
    Overflow:hidden;
  border:10px solid #8080C0;
  #marquee img {border:0px;
    #marquee DL, #marquee DT, #marquee DD, #marquee a {float:left;
    margin:0;
  padding:0;
    } #marquee dl {width:1000%;
  height:150px; } </style> <script type= "Text/javascript" > var Marquee = function (id) {try {Document.execcommand ("back
  Groundimagecache ", false, true);
  catch (e) {}; var container = document.getElementById (id), original = Container.getelementsbytagname ("DT") [0], clone = Container . getElementsByTagName ("dd") [0], speed = Arguments[1] | |
  10; Clone.innerhtml = original.innerhtml; Container.scrollleft = clone.offsetleft var rolling = function () {if (Container.scrollleft = = 0) {CONTAINER.S
    Crollleft = Clone.offsetleft;
    else {container.scrollleft--;
  } var timer = SetInterval (rolling, speed)//Set Timer Container.onmouseover = function () {clearinterval (timer) ////mouse over Marquee, clear timer, stop scrolling container.onmouseout = function () {timer = SetInterval (rolling, speed)}/////mouse move away Reset Timer} window.onload = function () {Marquee ("Marquee");} </script>  

The effect chart is as follows:

More readers interested in JavaScript-related content can view the site topics: "JavaScript switching effects and tips summary", "JavaScript Search Algorithm Skills Summary", "JavaScript animation effects and tips summary", " JavaScript error and debugging skills Summary, JavaScript data structure and algorithm skills summary, JavaScript traversal algorithm and skills summary and JavaScript mathematical calculation usage Summary

I hope this article will help you with JavaScript programming.

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.