I have a spash screen on a website that has a div with the ID of \"splash\" i\'m trying to make the div fade in then if the user clicks on the div it fades out and redircts
Try this:
$(document).ready(function() {
$('#splash').hide();
$('#splash').click(function(){
$(this).fadeOut(1000,function() {
window.location = 'http://www.example.com'; });
});
$('#splash').fadeIn(1000, function() {
window.setTimeout ( function() {
$('#splash').fadeOut(1000, function() {
window.location = 'http://www.example.com'; }) }
, 10000);
});
});
Changes that I've made to the example:
I've moved setting the click handler outside the fadeOut function (better practice, IMHO) and I've changed your call to delay() to a setTimeout().
The difference is, delay() will not allow other jQuery code to be executed in the background, while setTimeout() will.