Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#10201 closed bug (invalid)

slideUp() function not working, but hide() function does work

Reported by: tcarnell Owned by: tcarnell
Priority: low Milestone: None
Component: effects Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:

Description

Hi there,

I've just encountered a strange bug with the slideUp function. Basically I wire up a change() function for a checkbox. When the checkbox is changed, it should hide or show another div. Immediately after wiring up the change function the code directly calls the checkbox change() function to ensure the page/ui is in the correct state. Consider the following simplified code:

$( document).ready( function(){

	$('#my-checkbox').change( function() {
		if( $('#my-checkbox').is(':checked') ) {
			$('#my-input').closest('div.input-container').slideUp();
		} else {
			$('#my-input').closest('div.input-container').slideDown();
		}
		return false;
	});
	$('#my-checkbox').change();

});

We should expect on page load that $('#my-input').closeset('div.input-container') slides up to become hidden. But this does not happen. However, subsequent slideUp's do work and also changing the effect from 'slideUp()' to 'hide()' does work correctly first time round.

The code above is a simplification and in my source code a whole of other stuff is also happening on document ready.

Change History (5)

comment:1 Changed 8 years ago by addyosmani

Component: unfiledeffects
Owner: set to tcarnell
Priority: undecidedlow
Status: newpending

Thanks for submitting a ticket to the jQuery bug tracker!. Could you please provide us with a complete reduced test case on jsFiddle.net so that we can evaluate the behaviour mentioned under the same conditions and markup you've been testing under?. Thanks!

comment:2 Changed 8 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:3 Changed 7 years ago by tcarnell

I full test case can be found here:

http://staging.femtoo.com/jquerytest

If you look at the javascript code in the source of the above page, you will see that upon load, jQuery is asked to check the checkbox, but because the checkbox is not visible, it does not get checked. I believe this to be a bug - the visibility of the checkbox should not affect its ability to be checked.

More detail can be found from here: http://bugs.jqueryui.com/ticket/7943

This is a bug and I have been affected by this numerous times.

comment:4 Changed 7 years ago by tcarnell

Please re-open this bug!

comment:5 Changed 7 years ago by anonymous

I had the same problem and solved it, by adding "clear: both" to the style of the element, that should slideUp. Seems to be an floating-bug.

Note: See TracTickets for help on using tickets.