
Untitled
By: a guest on
Apr 29th, 2012 | syntax:
None | size: 0.99 KB | hits: 13 | expires: Never
How do I animate a <div>?
var self = $(this);
self.animate({
'top': ($(window).height() / 2) - (self.outerHeight() / 2),
'left': ($(window).width() / 2) - (self.outerWidth() / 2)
}, 600, 'swing', function () {
self.animate({
'width': '+=200px',
'height': '+=200px',
'top': ($(window).height() / 2) - (self.outerHeight() / 2), //NO UPDATE
'left': ($(window).width() / 2) - (self.outerWidth() / 2) //NO UPDATE
}, 600, 'linear');
});
'top': ($(window).height() / 2) - (self.outerHeight() / 2), //NO UPDATE
'left': ($(window).width() / 2) - (self.outerWidth() / 2) //NO UPDATE
'top': ($(window).height() / 2) - ((self.outerHeight()+200) / 2), // notice the +200
self.animate({
'width': '+=200px',
'height': '+=200px',
'top': ($(window).height() / 2) - ((self.outerHeight() +200 )/ 2), //NO UPDATE
'left': ($(window).width() / 2) - ((self.outerWidth() +200 )/ 2) //NO UPDATE
}, 600, 'linear');