Page 1 of 1

jQuery up and down sliding.

Posted: Fri Dec 16, 2011 11:10 am
by social_experiment
I have a form that is hidden and will be displayed when clicking a link; i created jQuery for this and it's working. Now i want the option to hide the form again but with the current code i have the form is show, but then closed again when i click the link. Below is my jQuery code, how can i modify it to keep the form displayed but allow me to hide it by clicking on the same link?

Code: Select all

$(document).ready(function() {
$('form').hide();
//$('a.current').click(function() {
$('a.more').click(function() {
$('form').slideDown('slow');
//$(this).hide();
return false;
});
});
// ----
$(document).ready(function() {
	$('a.more').click(function() {
		$('form').slideUp('slow');
		return false;
	});
});

Re: jQuery up and down sliding.

Posted: Fri Dec 16, 2011 11:21 pm
by Gopesh
Hi use slideToggle() method for it.
Check this Fiddle http://jsfiddle.net/nbAYb/.
Hope it works out.

Re: jQuery up and down sliding.

Posted: Mon Dec 19, 2011 12:55 am
by social_experiment
Thanks; it works perfectly :)