goldy19
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by goldy19
-
-
This works perfectly. Thank you!
-
Hi All!
I have two questions. I am still pretty new to Javascript, and I am using the W3.css file. I am trying to accomplish two things that I cannot, and my colleagues cannot figure out.
I am taking code that I sourced off of the W3 website.
The two things that I am trying to do is to have two image sliders on the same page that run at the same time, and the second thing is to have the images be in a random order. The only javascript that is running is for the second image slider.
Any assistance would be wonderful!
I am attaching a .zip of the files.
Thank you in advance!
Trevor
random order image gallery
in JavaScript
Posted
Hello All,
I am having trouble with this image gallery. I cannot seem to get the right lines of code to make it a random order gallery. Could you please point me in the right direction? Thank you so much!
I have 30 images in this gallery.
<script type="text/javascript">
var myIndex = 0;
carousel();
function carousel() {
var i;
var x = document.getElementsByClassName("mySlides2");
for (i = 0; i < x.length; i++) {
x.style.display = "none";
}
myIndex++;
if (myIndex > x.length) {myIndex = 1}
x[myIndex-1].style.display = "block";
setTimeout(carousel, 3000); // Change image every 2 seconds
}
</script>