Skip to main content

Bug Tracker

Side navigation

#1994 closed enhancement (fixed)

Opened November 30, 2007 10:55AM UTC

Closed November 30, 2007 09:42PM UTC

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:
Description

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').hover(function(){

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

}, function(){

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

});

The code should imho be:

$('#sitemapButton').hover(function(){

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

}, function(){

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

});

Attachments (0)
Change History (2)

Changed November 30, 2007 05:31PM UTC by davidserduke comment:1

owner: → 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.

Changed November 30, 2007 09:42PM UTC by davidserduke comment:2

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.