Skip to content

Instantly share code, notes, and snippets.

@kmgdevelopment
Last active August 29, 2015 13:58
Show Gist options
  • Select an option

  • Save kmgdevelopment/10162215 to your computer and use it in GitHub Desktop.

Select an option

Save kmgdevelopment/10162215 to your computer and use it in GitHub Desktop.
<script>
var menu = $('#contact-content');
$('.sidebar #contact-heading').click(function(){
var heading = $(this);
if ( $(window).width() < 600 ) {
if( menu.is(':visible') ) {
menu.slideUp('fast');
if( heading.hasClass('open') ) {
heading.removeClass('open');
}
heading.addClass('closed');
} else {
menu.slideDown('fast');
if( heading.hasClass('closed') ) {
heading.removeClass('closed');
}
heading.addClass('open');
}
}
});
</script>
<style type="text/css">
@media screen and (min-width: 600px) {
#contact-content {
display: block !important; /* override JS */
}
}
@media screen and (max-width: 599px) {
#contact-content {
display: none; /* hide on page load */
}
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment