[英]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.