jquery - move images in a line with timed effect -
the idea have div images ( in horizontal line) see first image within div. there 5 images. want move images right left leaving div (and screen) , after last images has moved first image in front (that 1 entire loop) start animation, click button.
now trick of this, @ every uneven numbered image animation has stop few moments. starting image 1, pass number 2 , stop @ 3 few seconds pass numver 4 , stop @ number 5 after image continues first 1 again , stops until start button clicked again.
i want able expand amount of images easy.
what have far in css / html is
<body> <div id="container"> <div id="fotos"> <div class="image"><img src="afb_stuk/1.png"/></div> <div class="image"><img src="afb_stuk/2.png"/></div> <div class="image"><img src="afb_stuk/3.png"/></div> <div style="clear:both"></div> </div> </div> <div id="start"> <h2 class="text"></h2> </div> </body>
and css
body{ padding:0px; margin:0px; background-image:url(afb_stuk/background.jpg); background-repeat:no-repeat; background-size:cover;} #container{ position:relative; margin-left:50px; margin-top:25px; height:600px; width:1250px; border:solid thin red; z-index:1; /*overflow:hidden;*/} #fotos{ position:relative; height:80%; width:12000px;} .image{ height:600px; width:1250px; float: left; .image img{ height:600px; width:auto;} #start{ position:relative; margin:auto; margin-top:-10px; height:10px; width:60px; border-radius: 25px; border: 2px solid #8ac007; padding: 20px; } .text{ margin-top:-10px;}
<html> <head> <script> function start() { var y=1; var x=document.getelementbyid("image"); setinterval(function(){check();},1000); function check() { if(y%2!=0) { settimeout(function(){},3000); } x.src=''+(y%6)+'.jpg'+''; y++; if(y==6) start(); } } </script> <style> body{ padding:0px; margin:0px; background-image:url(afb_stuk/background.jpg); background-repeat:no-repeat; background-size:cover;} #container{ position:relative; margin-left:50px; margin-top:25px; height:600px; width:1250px; border:solid thin red; z-index:1; /*overflow:hidden;*/} #fotos{ position:relative; height:80%; width:12000px;} .image{ height:600px; width:1250px; float: left; } .image img{ height:600px; width:auto;} </style> </head> <body> <div id="container"> <div id="fotos"> <div class="image"> <img src="1.jpg" id="image"/> </div> </div> </div> <button onclick="start()" id="new">click start!</button> </div> </body> </html>
your image names should in form of 1,2,3,4.jpg etc. , try accumulate delay between images.
Comments
Post a Comment