Created
January 28, 2020 05:44
-
-
Save jonschr/127a9bc27af05f6da5fad720359819b5 to your computer and use it in GitHub Desktop.
toggle the legend
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
<script> | |
jQuery(document).ready(function( $ ) { | |
//* vars for easier reference later | |
var togglelegendbutton = $( '.legendtoggle' ); | |
var legenddiv = $( '.organizerDiv' ); | |
var tabcontent = $( '.tabcontent' ); | |
//* this function does everything needed to toggle it | |
function togglethelegend() { | |
togglelegendbutton.toggleClass( 'activestate' ); | |
legenddiv.toggleClass( 'activestate' ); | |
tabcontent.hide(); | |
} | |
//* if someone clicks on the legend, toggle it | |
togglelegendbutton.on( "click", togglethelegend ); | |
//* on desktop only, go ahead and turn on the legend by default | |
if ($(window).width() > 600) { | |
togglethelegend(); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment