Skip to content

Instantly share code, notes, and snippets.

@darkcolonist
Created February 23, 2018 03:03
Show Gist options
  • Save darkcolonist/03001055bdf6eab6c1ff07d48098765a to your computer and use it in GitHub Desktop.
Save darkcolonist/03001055bdf6eab6c1ff07d48098765a to your computer and use it in GitHub Desktop.
active state in jquery
<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