Created
November 30, 2016 21:04
-
-
Save atomgroom/b10094f21ae5c982f9090b76cf02e22c to your computer and use it in GitHub Desktop.
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
// Below is the menu on mobile that opens the menu | |
<a class="mobile-menu-icon" onclick="javascript:toggle('menu');"> | |
<img src="/images/icon-menu.svg" /> | |
MENU | |
</a> | |
// Then there is some markup for the menu | |
// This script toggles the menu open and close, jumps the page to the top, and onWindow.Resize toggles the display (for responsive). | |
<script type="text/javascript"> | |
<!-- | |
function toggle(id) { | |
var e = document.getElementById(id); | |
e.style.display == 'block' ? e.style.display = 'none' : e.style.display = 'block'; | |
window.scrollTo(0, 0); | |
window.onresize = function(){ | |
e.style.display = ''; | |
}; | |
} | |
//--> | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment