Skip to content

Instantly share code, notes, and snippets.

@shakyShane
Created July 30, 2012 18:31
Show Gist options
  • Save shakyShane/3208988 to your computer and use it in GitHub Desktop.
Save shakyShane/3208988 to your computer and use it in GitHub Desktop.
Helper method to show/hide a menu & update an Icon with Twitter Bootstrap
$('.action').on('click', function(){
var icon = $(this).find('i');
var toggleIcon = function (){
var newIcon = (icon.hasClass('icon-plus')) ? 'icon-minus' : 'icon-plus' ;
icon.removeClass('icon-plus icon-minus');
icon.addClass(newIcon);
}
toggleIcon();
var action = $(this).data('action');
var elem = $(this).data('elem');
window[action](elem);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment