JS related Small instance--sliding effect

Source: Internet
Author: User

<! DOCTYPE html Public"-//w3c//dtd XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >0px}#wai{width:100%; height:500px;}#left{height:500px; Background-color: #63C; Float:left}#right{height:500px; Background-color: #FC3; Float:left}#anniu{width:50px; height:50px; Background-color: #F30; position:absolute ; top:225px; z-index:10;}#anniu:hover{Cursor:pointer}</style>varID;functionHua () {ID= Window.setinterval ("Dong ()", 10);}//Slide the method, adjust the sliding once 3pxfunctionDong () {//Change the width of blue 200px    varZuo = document.getElementById ("left"); KD= Zuo.style.width; if(parseint (KD).substr(0,kd.length-2)) >=800) {window.clearinterval (ID); return; } KD= parseint (KD).substr(0,kd.length-2)) +3; Zuo. Style.width = kd+ "px"; //Change the width of yellow    varyou = document.getElementById ("Right"); YKD= You.style.width; YKD= parseint (YKD.substr(0,ykd.length-2)) -3; You. Style.width = ykd+ "px"; //change the red left    varHong = document.getElementById ("Anniu"); Hleft= Hong.style.Left ; Hleft= parseint (hleft.substr(0,hleft.length-2)) +3; Hong. Style.left = hleft+ "px"; }</script></body>

Operation Result:

After clicking on the red area:

Final Result:

JS related Small instance--sliding effect

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.