38
rated 0 times
[
43]
[
5]
/ answers: 1 / hits: 9372
/ 9 Years ago, wed, may 13, 2015, 12:00:00
I thought this was going to be simple, but I am having a bit of hard time getting this to work. I am able to toggle once using .show and .hide, but not able to toggle back.
all the help would be appreciated.
here is the code:
<div class=middle>
<i class=fa fa-toggle-on fa-2x active id=on style=display:none;></i>
<i class=fa fa-toggle-on fa-2x fa-rotate-180 inactive id=off ></i>
</div>
$(document).ready(function(){
$('.middle').click(function(){
$('.inactive').show();
$('.active').hide();
})
.click(function(){
$('.inactive').hide();
$('.active').show();
});
});
I also have a pen of it here: http://codepen.io/lucky500/pen/qdZPLe
More From » jquery