Reputation: 47625
I have:
$(window).one('load',function() {
setTimeout(function() {
$('.slider').slideToggle('slow'),
15000
});
});
I'm trying to limit the animation to only once so as not to get annoying. The problem is: it's not waiting 15 seconds. It animates immediately.
Upvotes: 0
Views: 126
Reputation: 18215
The comma is in the wrong place.
The time is a parameter from setTimeout
function
$(window).one('load',function() {
setTimeout(function() {
$('.slider').slideToggle('slow');
},
15000);
});
Upvotes: 1
Reputation: 82028
I'm actually surprised that this compiles (or rather, does not yell at you) -- you misplaced a '}
'.
setTimeout(function() {
$('.slider').slideToggle('slow')
}, // <-- right there!
15000
);// <-- not there!
Upvotes: 2
Reputation: 13198
$(window).one('load',function() {
setTimeout(
function(){$('.slider').slideToggle('slow')},
15000
);
});
Upvotes: 2