簡體   English   中英

即使禁用了滾動,也可以平滑滾動到網頁的一部分嗎?

[英]Is it possible to make a smooth scroll to part of a webpage, even if the scrolling is disabled?

我已使用JS停止滾動:

<script>
window.onscroll = function () {
window.scrollTo(0,0);
}
</script>

也添加了CSS:

body{
overflow:hidden;
width:100%;
height:100%;
}

網頁的主要部分位於100%的高度。 另一部分(“ A ”)位於屏幕下方。


我只需要單擊錨點即可平滑滾動到頁面的此部分(“ A ”)。 但是仍然不能使頁面使用箭頭鍵滾動。

請查看此圖像! 鏈接

博客是這樣的-“ http://gaulifancy.blogspot.com ”當我單擊“深入了解”時,它應平滑向下滾動。
注意:使頁面更少滾動。

您是否嘗試過將帶有translateY的容器移動到視圖? 您網站的Codepen示例將非常有助於您。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM