Created
November 21, 2012 15:53
-
-
Save coolniikou/4125600 to your computer and use it in GitHub Desktop.
jQuery Scroll Setting
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
jQuery Scroll Setting | |
$(function () { | |
$(window).scroll(function(){ | |
if ($(this).scrollTop() > 100) { | |
$(".navbar.navbar-fixed-top").addClass("scroll"); | |
} else { | |
$(".navbar.navbar-fixed-top").removeClass("scroll"); | |
} | |
if ($(this).scrollTop() > 300) { | |
$('.scrolltop').fadeIn(); | |
} else { | |
$('.scrolltop').fadeOut(); | |
} | |
}); | |
$('.scrolltop').click(function(){ | |
$("html, body").animate({ scrollTop: 0 }, 700); | |
return false; | |
}); | |
$('.scroller').click(function(){ | |
var section = $($(this).data("section")); | |
var top = section.offset().top; | |
$("html, body").animate({ scrollTop: top }, 700); | |
return false; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment