JavaScript将页面scroll滑动到屏幕特定位置
参考这个两个页面的做法,总结而言,scrolltoview函数
页面内跳转到指定div的几种方法(锚点、hash、animate、scrollIntoView)_I大俊-CSDN博客: https://blog.csdn.net/hope_It/article/details/82586481,使用scrolltoview是最佳的
备注:也有其他方式:javascript - Scroll Automatically to the Bottom of the Page - Stack Overflow: https://stackoverflow.com/questions/11715646/scroll-automatically-to-the-bottom-of-the-page,使用window.scrollTo(0, document.querySelector(className).scrollHeight),window.scrollto但是会存在一些问题:如果页面长度不够,会导致无法正确显示想要目标位置。
本文来自博客园,作者:盒内有盖请小心打开,转载请注明原文链接:https://www.cnblogs.com/capinbox/p/15813951.html
English, https://dev.yiyideer.com/

浙公网安备 33010602011771号