Skip to content

Instantly share code, notes, and snippets.

@anndoko
Created June 7, 2017 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anndoko/4ca8f869b07e4d0cabe7647f284712de to your computer and use it in GitHub Desktop.
Save anndoko/4ca8f869b07e4d0cabe7647f284712de to your computer and use it in GitHub Desktop.
$(document).on('scroll', function () {
/*===== Welcome#index - 首頁導航列變化 =====*/
if ($(this).scrollTop() > 125) {
$('#navbar').addClass('show_bgcolor')
} else {
$('#navbar').removeClass('show_bgcolor')
}
/*===== Welcome#index - 回到頁面頂端 =====*/
if ($(this).scrollTop() > 2500) {
$(".goTop").fadeIn(100); //按钮出现时间(画面下移)
} else {
$(".goTop").fadeOut(200); //按钮消失时间(画面上移)
}
$(".goTop").click(
function() {
$('html,body').scrollTop(0);
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment