Created
February 4, 2017 00:06
-
-
Save bkaminski/d4428c6f562fa31ebe4c5a5bf00dfbbf to your computer and use it in GitHub Desktop.
Toggle FontAwesome icons on-click, toggles back to original state on second click
This file contains 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
//TOGGLE FONT AWESOME ON CLICK | |
$('.example-class').click(function(){ | |
var collapsed=$(this).find('i').hasClass('font-awesome-icon-1'); | |
$('.example-class').find('i').removeClass('font-awesome-icon-2'); | |
$('.example-class').find('i').addClass('font-awesome-icon-1'); | |
if(collapsed) | |
$(this).find('i').toggleClass('font-awesome-icon-1 font-awesome-icon-2') | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment