Angelseyez Posted October 27, 2017 Share Posted October 27, 2017 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! Link to comment Share on other sites More sharing options...
dsonesuk Posted October 27, 2017 Share Posted October 27, 2017 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. Link to comment Share on other sites More sharing options...
Angelseyez Posted October 27, 2017 Author Share Posted October 27, 2017 So the resolution is? What do I remove to fix it? How should the code read? Link to comment Share on other sites More sharing options...
justsomeguy Posted October 27, 2017 Share Posted October 27, 2017 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. Link to comment Share on other sites More sharing options...
Angelseyez Posted October 27, 2017 Author Share Posted October 27, 2017 Thank you so much. Unfortunately, I wouldn't know how to write that, as I am just in school learning. So that is above what I understand at this time. Link to comment Share on other sites More sharing options...
dsonesuk Posted October 28, 2017 Share Posted October 28, 2017 Try this topic http://w3schools.invisionzone.com/topic/55499-combine-the-manual-and-automatic-slideshow-script-into-one-script/ Link to comment Share on other sites More sharing options...
justsomeguy Posted October 30, 2017 Share Posted October 30, 2017 Variables are typically one of the first things you learn about with programming, you haven't gotten there yet? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now