ternary toggleClass jquery code example
Example 1: jquery toggle class
$( "#foo" ).toggleClass( 'className', addOrRemoveOptional );
Example 2: jquert toggleClass condition
// add class [class-name] if condition is true
// or else remove it
$('#foo-bar').toggleClass('class-name', condition)