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

Python __call__ special method practical example -

How can I edit my VIM config so that Vim treats ".ejs" files the same as it currently treats my html files? -