Created
February 23, 2018 03:03
-
-
Save darkcolonist/03001055bdf6eab6c1ff07d48098765a to your computer and use it in GitHub Desktop.
active state in jquery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
jQuery(document).ready(function(){ | |
jQuery(".panel-heading").on("click", function(e){ | |
var el = jQuery(e.currentTarget); | |
if(el.data('open')) | |
el.data('open', false); | |
else | |
el.data('open', true); | |
if(el.data('open')){ | |
el.find('.svg-inline--fa').removeClass('fa-angle-right'); | |
el.find('.svg-inline--fa').addClass('fa-angle-down'); | |
}else{ | |
el.find('.svg-inline--fa').addClass('fa-angle-right'); | |
el.find('.svg-inline--fa').removeClass('fa-angle-down'); | |
} | |
}) | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment