samedi 28 février 2015

jquery - How to return default height toogle automaticly by clicking another place


Here, I have a working toogle code,so I have added some code that when click another place also return to default height(32px),but not working.



var toggled = false;
$('.dropdown-toggle').click(function() {
$('.changeHeight').css('height', toggled ? '32px' : '65px');
toggled = !toggled;
});

$(document).click( function(){ // if click another place will set default height
$('.changeHeight').css('height','32');
});




Aucun commentaire:

Enregistrer un commentaire