Get link Facebook X Pinterest Email Other Apps - February 19, 2016 How To Add Image Gallay to HTML page having Next and Prev using Java script: PREW NEXT here is the simple implimentation of java script controll using html buttons. >We can navigate our gallary forward and backward >Insted of image you can use Advertisement >Parameter that can modify *give particular id for 'img' tag here I give 'gali' *all image having same naming format here i used "1.jpeg, 2.jpeg ,3.jpeg....." *in Java script you have to modify 'noOfImage' that the count of your image in folder 'css/gal/' *just put this code in your page and make folder of image at from yor root folder "css/gal/". put your images inside it. <img id="gali" src="css/gal/1.jpg" alt="" class="galImg" height="200px" /> <button onClick="prevImg()">PREV</button> <button onClick="nextImg()">NEXT</button> <script type="text/javascript"> var a=1; var noOfImage=5 var x ="css/gal/1.jpg"; function nextImg(){ if(a<noOfImage){ a=a+1; x ="css/gal/"+a+".jpg"; document.getElementById("gali").src=x; } } function prevImg(){ if(a>1){ a=a-1; x ="css/gal/"+a+".jpg"; document.getElementById("gali").src=x; } } </script> Get link Facebook X Pinterest Email Other Apps Comments
Comments
Post a Comment