Angelseyez 0 Posted October 27, 2017 Report 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! Quote Link to post Share on other sites
dsonesuk 925 Posted October 27, 2017 Report 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. Quote Link to post Share on other sites
Angelseyez 0 Posted October 27, 2017 Author Report Share Posted October 27, 2017 So the resolution is? What do I remove to fix it? How should the code read? Quote Link to post Share on other sites
justsomeguy 1,135 Posted October 27, 2017 Report 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. Quote Link to post Share on other sites
Angelseyez 0 Posted October 27, 2017 Author Report 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. Quote Link to post Share on other sites
dsonesuk 925 Posted October 28, 2017 Report Share Posted October 28, 2017 Try this topic http://w3schools.invisionzone.com/topic/55499-combine-the-manual-and-automatic-slideshow-script-into-one-script/ Quote Link to post Share on other sites
justsomeguy 1,135 Posted October 30, 2017 Report Share Posted October 30, 2017 Variables are typically one of the first things you learn about with programming, you haven't gotten there yet? Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.