Created
February 26, 2019 02:14
-
-
Save planetoftheweb/0aa3a1c792d23325848ca3bf99b21d37 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$(document).ready(function() { | |
// When Scrollspy Detects a change | |
$(window).on("activate.bs.scrollspy", function() { | |
var hash = $(".site-nav") | |
.find("a.active") | |
.attr("href"); | |
if (hash == "#main-content") { | |
$(".site-nav").addClass("inbody"); | |
} else { | |
$(".site-nav").removeClass("inbody"); | |
} | |
}); | |
$(window).trigger("scroll"); | |
$(window).on("scroll", function() { | |
var top = $(window).scrollTop(); | |
$("#page-hero") | |
.css("transform", "translate3d(0px, " + top / 5 + "px, 0px)") | |
.css("opacity", 1 - Math.max(top / (window.innerHeight * 0.7), 0)); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment