Reputation: 25
I am trying to have my ul menu fly in from the left side of the page when the document loads using jquery. How would I go about doing this? Thanks for the help.
Upvotes: 1
Views: 284
Reputation: 184
Launching off of what Dipesh Parmar started, I've made another working demo with a few key differences:
var startPos = 0 - objWidth;
left: $(document).width() - objWidth - 15
to move it to the edge of the page, displaying the full object (plus a little padding) Since the demo is a little bit overly complicated likely for what you want, here's what the code you're after boils down to
var plane = $("#plane");
plane.css('left', plane.width()*-1); // Initially position the object off the page
plane.animate({
left: $(document).width() - $("#plane").width() - 15 // Go to the right edge, show the whole object, and some padding
}, 3000, 'linear') // Action takes 3000 milliseconds in a linear motion
Check out jQuery's animation documentation for more http://api.jquery.com/animate/
Upvotes: 0
Reputation: 27364
You can use jQuery.animate
to animate element.
Example
$(document).ready(function(){
$('ul').animate({left:'20px'},800);
});
I have created other DEMO
for you to see it.
Upvotes: 1