Reputation: 271
My javascript skills are pretty basic but I'm trying to learn more, so was wondering if someone could help me out or point me in the right direction as I'm a bit puzzled with a site I'm working on.
The site is: http://epaints.co.uk/ basically I am trying to get the home page slider to slide automatically on page load, at the moment it only slides when the user clicks the navigation buttons.
$('.caro-arrow.caro-arrow-r').click( function () {
setTimeout("$('.caro-arrow.caro-arrow-r').click()", 4000);
});
I always thought it was a simple as adding the below code for it to auto slide, but it doesn't seem to work:
auto: true,
autoControls: true
Like I said, if anyone can help me out or point me in the right direction, it would be greatly appreciated!
Thanks for your help :-)
Upvotes: 0
Views: 85
Reputation: 824
Use the following code in your $(document).ready(function () { /* HERE */ })
$('.caro-arrow.caro-arrow-r').click( function () {
setTimeout("$('.caro-arrow.caro-arrow-r').click()", 4000);
}).trigger('click');
We don't need to write the same function twice, just trigger click so that it runs on page load.
Upvotes: 1