Bug Tracker

Modify

Ticket #4313 (closed bug: invalid)

Opened 4 years ago

Last modified 2 years ago

slideToggle().css('display') always return 'block'

Reported by: bato3 Owned by:
Priority: major Milestone: 1.4
Component: unfiled Version: 1.3.2
Keywords: Cc:
Blocking: Blocked by:

Description

my log from FireBug:

$('#hc_c6').slideToggle().css('display');

"block"

$('#hc_c6').slideToggle().css('display');

"block"

$('#hc_c6').slideToggle().css('display');

"block"

Now #hc_c6 is visible:

$('#hc_c6').slideUp().css('display');

"block"

$('#hc_c6').slideUp().css('display');

"none"

As you see in example, 2-nd slideUp() call return correct value...

Change History

comment:1 Changed 4 years ago by dantman

How do you expect this to behave?

slideUp is an animation, a call to .css directly after starting an animation will always be unreliable like that. When you call the animation jQuery starts of by preparing the element to be animated, this includes turning the display of the element on, and setting an overflow and other css which make it possible to animate the element cleanly.

The only reason your second .slideUp returns none instead of display is because the element is already closed and no animation is being done.

comment:2 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

I agree with dantman, .css has to change the property to start the animation.

comment:3 Changed 2 years ago by Danny

issue persist with jQuery 1.5

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.