![](/img/trans.png)
[英]Why do not I reload the data when I scroll down and do it when I go back to the top of the page in my infinite scroll?
[英]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?
所以我有一个 API,我添加了一个页面顶部按钮。 该按钮在我构建的 2 个网页上的移动和桌面上运行良好,但对于我的 API 应用程序(尤其是这个),当我使用移动屏幕尺寸时,它会滞后/卡顿/卡住。 看看我的屏幕截图,这里是代码:
<!--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;
});
});
我找到的唯一解决方案是从不同来源获取另一个按钮和代码。 你在谷歌上找到的很多这些似乎都不起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.