jQuery Slider doesn't work anymore

Hey,

I built a site with a slider which already worked for a while but it doesn’t anymore. I really regret that I didn’t wrote something like a change log or a history of the file versions or something. So I changed the background pictures of the slider and some other css stuff with the caption and suddenly the slider didn’t work anymore. The pictures appear, but they don’t slide and those buttons for switching the pictures don’t come up anymore.

I can’t remember what I changed before and I don’t know whats wrong now, I checked all the linkers to the jQuery files but could not find the mistake.
The project is uploaded to my webspace on http://www.phermann.tk/gera .

I hope you can help me. (I am totally expecting a dump mistake by the way.)
Thank you, Paul.

Try moving this bit in red:

<body>
        [COLOR="#FF0000"]<script>
            $('.slider').glide();
        </script>[/COLOR]

to the bottom of the page, just before the </body> tag:


        <script>
            $('.slider').glide();
        </script>
[COLOR="#FF0000"]</body>[/COLOR]

At the moment, the script is looking for the .slider div before it has loaded, so let it load first and then call on it with JS.

Great, that solves the problem. Know as you wrote it, I actually don’t understand why the jQuery isn’t like that instead:

<script>
$(document).ready(function() {
$(‘.slider’).glide();
)};
</script>

The position of the code would be unimportant then.

Thanks! :slight_smile:

That should still be at the bottom of the page for it to work right. It waits for the document to be ready before initialising.

Yes, that’s commonly done with jQuery if you don’t place it at the end of the file. (document).ready just makes sure that the document has loaded before the script operates. I had two choices—to tell you to place the code at the bottom OR to wrap document.ready around it. But I chose the first option as it’s a good idea anyway.