Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello first of all.

I've a little problem with my website, I decided to put in the main page a slideshow of different cinematographic pictures. My problem is when I slide with my cursor to the bottom of the page, when a picture changes to the next one the page goes automatically up without even clicking to go up ... I have put a script in my code so it can changes the photos, do you think that's the problem ?

Thank you so much beforehand !

What I have tried:

This is the script i got

JavaScript
var myIndex = 0;
carousel();

function carousel() {
    var i;
    var x = document.getElementsByClassName("myslides");
    for (i = 0; i < x.length; i++) {
       x[i].style.display = "none";
    }
    myIndex++;
    if (myIndex > x.length) {myIndex = 1}
    x[myIndex-1].style.display = "block";
    setTimeout(carousel, 3000);
}
Posted
Comments
A_Griffin 18-Jan-18 13:38pm    
On the face of it, there is nothing in that script to cause the page to jump back to the top (or re-load) so I suspect there is something else in your page causing your problem. (I've seen that script before - from W3Schools, am I right?)
Member 13630887 18-Jan-18 16:35pm    
Yes i saw this script on w3schools. So I will try to see in the rest of my html code what can be causing the problem then. Thanks for the reply !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900