[英]Why does my top of page button stutter/lag/stick when I scroll to top and then back down on my API app but acts normal on webpages?
So I have an API that I added a top of page button to.所以我有一个 API,我添加了一个页面顶部按钮。 The button works fine on mobile and desktop on 2 webpages I built but for my API apps (this one especially) it lags/stutters/sticks when I get down to mobile screen sizes.
该按钮在我构建的 2 个网页上的移动和桌面上运行良好,但对于我的 API 应用程序(尤其是这个),当我使用移动屏幕尺寸时,它会滞后/卡顿/卡住。 Take a look at my screen shot and here is the code:
看看我的屏幕截图,这里是代码:
<!--Top of Page Button-->
<div class="top_link_position">
<a class="back-to-top" href="#page_top" title="Top">
<button class="top_btn">
<i class="fas fa-arrow-up fa-3x"></i>
</button>
</a>
</div>
.top_link_position {
display: block;
position: fixed;
bottom: 4%;
right: 3%;
z-index: 600;
}
.top_btn {
border: 1.5px solid white;
background: #db0606;
padding: .5rem .5rem;
color: white;
font-weight: bolder;
text-transform: uppercase;
}
$(document).ready(function () {
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
$('.back-to-top').fadeIn();
} else {
$('.back-to-top').fadeOut();
}
});
$('.back-to-top').click(function () {
$("html, body").animate({
scrollTop: 0
}, 100);
return false;
});
});
The only solution I found was getting another button and code from a different source.我找到的唯一解决方案是从不同来源获取另一个按钮和代码。 A lot of these you find on google don't seem to work.
你在谷歌上找到的很多这些似乎都不起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.