简体   繁体   English

Javascript转到首页按钮

[英]Javascript go top page button

I have the code of go to top sroll function. 我有转到顶部滚动功能的代码。 The button that am fixed in my home page is showing when am redirecting home page i dont want that button in top of my home page i want that button while scrolling down wot i do? 重定向主页时,显示我主页中固定的按钮,我不希望该按钮出现在我的主页顶部,我想在向下滚动时我想要该按钮吗?

i think i didn't get your question right but maybe you need to try "position: fixed" for the tag?! 我认为我没有正确回答您的问题,但也许您需要尝试标记的“位置:固定”? is that what you are looking for? 那是您要找的东西吗?

edit: 编辑:

set your top-button to invisible: 将顶部按钮设置为不可见:

#top {
  visibility: hidden;
}

when the user scrolls you activate it! 当用户滚动时,您将其激活!

$(window).scroll(function () { 
  $('#top').css("visibility", "visible"); 
});

when the top-button is clicked you simply hide it again: 单击顶部按钮时,您只需再次将其隐藏即可:

$('#top').click(function () { 
  $('#top').css("visibility", "hidden"); 
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM