Bug Tracker

Modify

Ticket #10742 (closed bug: invalid)

Opened 19 months ago

Last modified 19 months ago

is(:visible) always returns true when toggle('fast') is used

Reported by: jas@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.6.4
Keywords: Cc:
Blocking: Blocked by:

Description

I am new to jquery and am working with some pretty simple stuff. So this issue may be something that is a "feature" rather than a bug.

Here is the code:

	$('.accordion-hide').click(function(){
		$('.accordion').toggle('fast');
		if ($('.accordion').is(':visible')){
			alert('hide');
			$('.accordion-prompt').html('Hide this Help');
		}
		else
		{
			alert('show');
			$('.accordion-prompt').html('Show Help for this Page');
		}
	});

The problem is that the "true" branch of the if-statement is always taken when 'fast' is present as an argument to toggle. Removing 'fast' and the change of the text works as expected. But with 'fast' present, the true branch is always taken, as shown by the alerts.

Change History

comment:1 Changed 19 months ago by dmethvin

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

The .toggle("fast") happens asynchronously. Since it hasn't finished yet the code below it still sees the element as visible.

Please ask for help on the forum before opening a bug ticket, to be sure it is a bug. Also, we need complete test cases on jsFiddle.net rather than snippets of code within the ticket...we can't run those.

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.