Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html “返回页脚顶部”按钮_Html_Css - Fatal编程技术网

Html “返回页脚顶部”按钮

Html “返回页脚顶部”按钮,html,css,Html,Css,我有一个关于如何创建一个固定在页脚上的滚动返回顶部按钮的问题? 像这个 您可以使用jquery对其进行查询 $("#button").click(function() { $('html, body').animate({ scrollTop: $("#header").offset().top }, 2000); }); Html 这是plnkr 您只需向希望跳转到的ID添加一个a标记和href=。例如: 你的代码越高,比如在你的身体标签下面, 如果您愿意,在

我有一个关于如何创建一个固定在页脚上的滚动返回顶部按钮的问题? 像这个


您可以使用jquery对其进行查询

$("#button").click(function() {
    $('html, body').animate({
        scrollTop: $("#header").offset().top
    }, 2000);
});
Html

这是plnkr


您只需向希望跳转到的ID添加一个a标记和href=。例如: 你的代码越高,比如在你的身体标签下面, 如果您愿意,在页面下方的多个位置,添加一个标签,该标签引用链接中的lD。当您单击该href a标记时,它将视图端口/屏幕的顶部推到该div

基本HTML:

<div id="wrapper">  
  <div id="top"></div>
  <div id="container>
    <div class="header">Welcome</div>
    <p>......whole bunch of content</p>
  </div>
  <div class="footer"><a href="#top">Back to the top</a>
</div>

祝你好运。

你能给出全部答案吗code@Hax_dz我编辑我的答案。检查这个!问题解决:DThnx这是helpful@Hax_dz很高兴我能帮忙。如果您对答案感到满意,请不要忘记将您的答案标记为已解决。顺便说一句,这里有一个JSFIDLE,不过您只需要简单的html即可实现这一点。
<div id="wrapper">  
  <div id="top"></div>
  <div id="container>
    <div class="header">Welcome</div>
    <p>......whole bunch of content</p>
  </div>
  <div class="footer"><a href="#top">Back to the top</a>
</div>