Html 如何单击容器并触发页面滚动到网页的特定区域?

Html 如何单击容器并触发页面滚动到网页的特定区域?,html,Html,这是集装箱: .divider {display:block; position: absolute; top:calc(100vh - 80px); width: 100%; text-align: center; font-family: "Avenir Lt Std", Arial; color:white; font-size:12px; background-color:#005A85;padding-top:8px; padding-bottom: 30px; z-index:-1}

这是集装箱:

.divider {display:block; position: absolute; top:calc(100vh - 80px); width: 100%; text-align: center; font-family: "Avenir Lt Std", Arial; color:white; font-size:12px; background-color:#005A85;padding-top:8px; padding-bottom: 30px; z-index:-1}
以下是html中的容器:

<section class="divider">
<h2> text text</h2>
</section>

预期的行为是,当用户单击文本时,页面滚动到网站底部或页面的特定区域。

如果您有一个特定的div或您希望它跳转以仅使用的内容:

<a href="#divIdOrSomething"><h2>text text</h2>
它将水平跳转500次,更改要跳转到的位置的值

带运动的javascript

$('html, body').animate({
     window.scrollTo(0,document.body.scrollHeight);
},500); // scroll animation time in milliseconds

最简单的方法是使用锚定标记文本,然后将实际标记放置在您希望它落在网页内容中的位置。像这样的: 网页的一些文本。 更多文本 额外的东西

请参见此Jquery示例


你想怎么做?Html、javascript、jquery?我们需要更多的信息,因为有几种方法可供使用。在网站、移动应用程序、ipad上,哪种方法最容易实现相同的行为。谢谢谢谢有没有一种方法可以复制滚动运动而不是跳转到锚点?使用java脚本是否提供滚动运动?如果是,1如何在html中实现?对不起,我是新来的?2您如何简单地滚动到页面底部?谢谢在我的答案中添加了一个脚本以提供滚动动画。然后只需在HTMLH中添加一个onclick,您如何将按钮更改为链接?使用href并在其上提供侦听器,或直接在href中提供id,但我认为上述解决方案对您有帮助
$('html, body').animate({
     window.scrollTo(0,document.body.scrollHeight);
},500); // scroll animation time in milliseconds
$('button').click(function() {
    $('html, body').animate({
        scrollTop: $(".divider").offset().top
    }, 2000);
});