How can I achieve a sort of like slider without clicking? Here is a sample from JSFIDDLE.
From the sample, we have to click onto image to view the next content. But what I want is, for it to fade in and wait 5 seconds, and then fade out to next content.
Do I have to change anything from the javascript here?:
$('#two, #three').hide();
$('.slide').click(function(){
$(this).fadeOut().next().fadeIn();
});
I am new in this. Please guide me. Many thanks in advance!
You can use chained events to trigger one once the other is over and the
delay()
function to make the events "wait" to happen:EDIT
You can adjust the parameter of the
delay()
function to any amount of milliseconds you like.EDIT2
To make a function run as soon as the page loads, you can use JQuery's
$(document).ready()
.FIDDLE