如何添加“转到顶部按钮”或滚动到顶部按钮进入HTML 5页? [英] How to add "Go to top Button " or scroll to top button into html 5 page?

查看:109
本文介绍了如何添加“转到顶部按钮”或滚动到顶部按钮进入HTML 5页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何添加转到顶部按钮或滚动到顶部按钮进入html 5页面?



i有一个带有html 5的Angular js SPA现在我想要将滚动添加到顶部或转到顶部按钮进入我的Index.html页面。怎么可能???

How to add "Go to top Button " or scroll to top button into html 5 page?

i have a Angular js SPA with html 5 now i want to add scroll to top or go to top button into my Index.html page. how it is possible ???

推荐答案

我在jsfiddle中做了一个小例子。希望对您有所帮助。



点击此处 [ ^ ]



按钮无论页面/文档/内容如何,​​都只是放在底部。一旦页面开始滚动,请确保页面上有一个浮动按钮。



你可以使用

I did a small example in jsfiddle. Hope that helps you.

Click Here[^]

Button is just placed at the bottom irrespective of the page/document/content. Please make sure you have a floating button in the page as soon as the page starts scrolling a little.

You can use


document )。on('' scroll' function (){
// 使用CSS显示浮动按钮
});
(document).on( 'scroll', function(){ // Make the floating button visible with CSS });





点击按钮,使用以下代码



On click of button, use the below code


#scrollUp)。on(' 点击'功能(){
("#scrollUp").on('click', function(){


这篇关于如何添加“转到顶部按钮”或滚动到顶部按钮进入HTML 5页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆