javascript - jQuery toggle .click() function -


i unsure if "callback' need or not, trying emulate reversal of function on .hover() effect .click() effect. possible. basically, if user clicks again on link, reverse of happened, ie div closing opposed opening, happen. possible .click()?

$(document).ready(function(){     $('.content_accrd').css({"height":"0px"}); $('.paneltop').click( function() {     $(this).css({"background-position":"0px -21px"})     .siblings().animate({"height":"100px"}, 200) }, function() { $(this).css({"background-position":"0px 0px"})     .siblings().animate({"height":"0px"}, 200);  }) }) 

use .toggle(), not .click().

description: bind 2 or more handlers matched elements, executed on alternate clicks.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -