Skip to content

Instantly share code, notes, and snippets.

@bumble-bee-chuna
Created November 29, 2016 23:47
Show Gist options
  • Save bumble-bee-chuna/8d03e613d7853333fb307df864982f4b to your computer and use it in GitHub Desktop.
Save bumble-bee-chuna/8d03e613d7853333fb307df864982f4b to your computer and use it in GitHub Desktop.
/* If on a desktop, change nav's logo and hamburger when past the hero */
if( screen.width >= 875 ) {
var scroll_pos = 0;
$(document).scroll(function() {
scroll_pos = $(this).scrollTop();
if(scroll_pos > 520) {
$("#logo").attr("src", "assets/images/logo-scroll.svg");
$("#hamburger").attr("src", "assets/images/hamburger-scroll.svg")
} else {
$("#logo").attr("src", "assets/images/logo.svg");
$("#hamburger").attr("src", "assets/images/hamburger.svg");
}
});
}
/* Popout sidebar navigation */
function openNav() {
document.getElementById("sidebar-nav").style.width = "90%";
}
function closeNav() {
document.getElementById("sidebar-nav").style.width = "0";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment