The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Image Slideshow
Mattab0lism
post Jun 16 2018, 05:57 AM
Post #1





Group: Members
Posts: 5
Joined: 16-June 18
Member No.: 26,660



Hi everyone, i'm making a site with a slideshow and have all my images in one folder "images" same heirahcy as the html

<div style="position: relative; left: 50%; ">
<img id="myButton" src="images/2.png" width= 900 style="background-color: white;"/>
<script type="text/javascript">
var images = ['images/chaos1.png', 'images/chaos2.png', 'images/chaos3.png', 'images/chaos4.png', 'images/chaos5.png', 'images/chaos6.png', 'images/chaos7.png', 'images/chaos8.png'],
i = 1;

// preload
for (var j=images.length; j--wink.gif {
var img = new Image();
img.src = images[j];
}

// event handler
document.getElementById('myButton').addEventListener('click', function() {
this.src = images[i >= images.length - 1 ? i = 0 : ++i];
}, false);
</script><br><br>
</div>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic
Mattab0lism   Image Slideshow   Jun 16 2018, 05:57 AM
Mattab0lism   SOLVED: <div id="imageGallery1"style...   Jun 16 2018, 12:23 PM


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 21st March 2019 - 02:34 AM