Reputation: 15488
This will hopefully be a simple one: I have a div I want to slide into the screen when the page loads.
I'm trying to find out why this works:
$(function() {
$('.mydiv').slideDown(500);
});//END ONLOAD
But not this:
$(function() {
$('.mydiv').show('slide', { direction: 'down' }, 500);
});//END ONLOAD
Can anyone give me some advice? Thanks!
(ps: CSS is .mydiv {display:none;}
Upvotes: 0
Views: 1797
Reputation: 171700
jQuery core does not include effects for show()
method, however jQueryUI extends show()
with effects. Code you have displayed would require you to include jQueryUI library ( or components) along with jQuery .
show( effect, [options], [speed], [callback] )
Upvotes: 1
Reputation: 5894
The Jquery API docs for the show method state that the show method defintions are as follows:
.show()
.show( duration [, callback] )
.show( [duration] [, easing] [, callback] )
where:
duration - A string or number determining how long the animation will run.
easing - A string indicating which easing function to use for the transition.
callback - A function to call once the animation is complete.
the correct implementation using show would be
.show(500);
Upvotes: 0