[英]How to hide scrollbar in Chromium when static , but show when scrolling?
設置一個計時器來顯示滾動條,並在滾動事件中重置計時器並顯示滾動條:
var el = document.body; // you can use the following code on any element
var showScrollbarTimeout = 0; // track the timeout function so that we can reset it later
function hideScroll () { el.style.overflow = "hidden"; }
function showScroll () { el.style.overflow = "visible"; }
function hideLater () { showScrollbarTimeout = setTimeout(hideScroll, 1000); }
hideLater();
el.onscroll = function () {
clearTimeout(showScrollbarTimeout);
showScroll();
hideLater();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.