Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(document).ready(function($) {
- // Add class .fixed when .site-header hits top of viewport
- var distance = $('.site-header').offset().top,
- $window = $(window);
- $window.scroll(function() {
- if ( $window.scrollTop() >= distance ) {
- $(".site-header").addClass("fixed");
- }
- if ( $window.scrollTop() < distance ) {
- $(".site-header").removeClass("fixed");
- }
- });
- // Add class .scrolled on scroll to control show/hide of back-top button
- $(window).scroll(function() {
- var scroll = $(window).scrollTop();
- if (scroll >= 200) {
- $("body").addClass("scrolled");
- }
- if (scroll <= 200) {
- $("body").removeClass("scrolled");
- }
- });
- });
- var onScroll = function(minimumDistance, className){
- var scroll = $(window).scrollTop();
- if (scroll >= minimumDistance) {
- $("body").addClass(className);
- }
- if (scroll < minimumDistance) {
- $("body").removeClass(className);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement