Skip to content

Instantly share code, notes, and snippets.

@Lif3line
Created May 27, 2014 07:58
Show Gist options
  • Save Lif3line/2c328ca20fb021f44d1e to your computer and use it in GitHub Desktop.
Save Lif3line/2c328ca20fb021f44d1e to your computer and use it in GitHub Desktop.
Static toggling function for a single element - could be a button, sliding panel etc
function toggle() {
if($('#toggleElement').data("toggledOn")) { // Turn off
$('#toggleElement').data("toggledOn",false);
/* Do something */
} else { // Turn on
$('#toggleElement').data("toggledOn",true);
/* Do something */
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment