Reputation: 20189
I am looking to gain a effect on my page similar to host-gators live chat thing, I've looked here and this is similar to what I'm trying to achieve but there is one problem the div
like starts at height:1px
and slides the div
down to its original height, what I want is for the div
s height to always be the same and it slide down from the top of the page and not the top of the div
, I hope this explains it well.
Upvotes: 0
Views: 124
Reputation: 33378
What you mean is a blind
-effect. Take a look here: http://fiddle.jshell.net/cZQTR/
I've written a small plugin for that fx:
jQuery.fn.blindToggle = function (duration, easing, complete) {
return this.animate({
marginTop: parseFloat(this.css('marginTop')) < 0 ? 0 : -this.outerHeight(true)
}, jQuery.speed(duration, easing, complete));
};
Update
jQuery.fn.blindUp = function (duration, easing, complete) {
return this.animate({
marginTop: -this.outerHeight(true)
}, jQuery.speed(duration, easing, complete));
};
jQuery.fn.blindDown = function (duration, easing, complete) {
return this.animate({
marginTop: 0
}, jQuery.speed(duration, easing, complete));
};
Upvotes: 1