Jump to content
Angelseyez

Slideshow

Recommended Posts

Hey All.... HELP!

I am not versed in Javascript, but have been trying to research the forum for a resolution to the slideshow bug. The first image in the slideshow does not appear when the page first loads. If I click the "next" arrow, then the image will appear. I would like the slideshow to show the first image when the website page first loads. 

I have my HTML, CSS & Javascript files all separate, I have linked my CSS & JS file through the head of my HTML file. 

If someone could assist me by providing me the code fix for both the manual and/or automatic slideshow method, it would be greatly appreciated. I still want the prev/next arrows to work through both methods. I am just trying to give myself options in future to change the code if I do not want to keep the manual, I then would have the correct code to switch to the automatic slideshow. Hence why I am asking if someone can help me with providing the code fix for both methods. 

 

Here is the Javascript code I have for both methods. https://codeshare.io/50VgdL

Assistance would be greatly appreciated, it's for a school assignment! 

 

Share this post


Link to post
Share on other sites

You have 2 var slideIndex, but those two scripts will conflict with each other, because as soon as you use side navigation (showSlides()), the automatic slideshow script could at the same time move to next slideshow, given the wrong image.

Share this post


Link to post
Share on other sites

Each function needs to use its own variables.  They shouldn't share a global variable like slideIndex, use a different variable for the other function.  

Share this post


Link to post
Share on other sites

Variables are typically one of the first things you learn about with programming, you haven't gotten there yet?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...