![](/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.