Analysis of js motion application instances and js Application Instances
This article provides two examples of js motion applications. The specific implementation content is as follows:
Application 1:
The js Code is as follows:
<script src="move.js"></script><script>window.onload=function (){ var oDiv=document.getElementById('play'); var aBtn=oDiv.getElementsByTagName('ol')[0].getElementsByTagName('li'); var oUl=oDiv.getElementsByTagName('ul')[0]; var now=0; for(var i=0;i<aBtn.length;i++) { aBtn[i].index=i; aBtn[i].onclick=function () { now=this.index; tab(); }; } function tab() { for(var i=0;i<aBtn.length;i++) { aBtn[i].className=''; } aBtn[now].className='active'; startMove(oUl, {top: -150*now}); } function next() { now++; if(now==aBtn.length){now=0;} tab(); } var timer=setInterval(next, 2000); oDiv.onmouseover=function (){clearInterval(timer);}; oDiv.onmouseout=function (){timer=setInterval(next, 2000);};};</script>
Application 2:
The Code is as follows:
<! DOCTYPE html>
The above is all the content of this article, hoping to help you learn.
Articles you may be interested in:
- Using JavaScript to play games Physics (I) Kinematics Simulation and Particle System
- Circle movement of javascript animation, move around the mouse as a ball
- A detailed introduction to the constant speed and variable speed (buffer) motion in JavaScript
- How to Use js to implement motion logo image effects and motion Element Object sportBox
- How to achieve constant object speed/variable speed using JavaScript
- Js motion framework _ including fade-in and fade-out effects of images
- Example of how Javascript achieves gravity bounce drag
- Code example for JS to achieve constant speed
- Eight knowledge points of js Motion Animation