Bug Tracker

Opened 15 years ago

Closed 15 years ago

#1994 closed enhancement (fixed)

slideDown does not reset height after stopped

Reported by: holgerh Owned by: davidserduke
Priority: major Milestone: 1.2.2
Component: effects Version: 1.2.1
Keywords: Cc:
Blocked by: Blocking:


When slideDown() is activated on an element and stopped before it has been completed, the height of the element is not reset to the initial value. The next time slideDown is activated the element will slide down only to the (wrong) height in the element.style.

For example an element has (normally) the height of 300px. slideDown is activated, the element slides down but the animation is stopped when it reached 180px. The next time slideDown is activated for this element it will slide down to 180px only but not 300px.

So for now I have to fix this manually by resetting the element.style like this:


$('#sitemapButton .overlay').slideDown();

}, function(){

$('#sitemapButton .overlay').stop().hide().css('height', );


The code should imho be:


$('#sitemapButton .overlay').slideDown();

}, function(){

$('#sitemapButton .overlay').stop().hide();


Change History (2)

comment:1 Changed 15 years ago by davidserduke

Owner: set to davidserduke
Status: newassigned
Type: bugenhancement

I'm afraid this isn't a bug but rather a design issue. stop() was defined to completely stop the animation where it was, immediately, and it does. That means since it never completes the animation any "saved" information will be lost and have to be reset if you need it (as you noted). And are cases where that is exactly what you might want.

That said, I realize animate is mostly used in slideDown type instances and having to reset everything is a pain. I'm going to mark this as an enhancement and take a look at it to see what (if anything) can be done without a major overhaul.

comment:2 Changed 15 years ago by davidserduke

Resolution: fixed
Status: assignedclosed

New functionality added in [3989]. Read the changeset to see the new parameters to stop(). This is about as far as it can go. The way the jQuery animation system works each animation in the queue doesn't know about the others so it is not possible to stop an animation midstream (like a slideDown half way down) then have the next in the queue (like a slideUp) start from the same spot and go back up.

It can be done, but it would have to be done by hand, the system won't do it for you. That said, these changes make stop() more useful I think.

Note: See TracTickets for help on using tickets.