博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jQuery 回到顶端
阅读量:4554 次
发布时间:2019-06-08

本文共 550 字,大约阅读时间需要 1 分钟。

<!doctype html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title></title>

</head>

 

<style>

body{height:2500px;}

.go_top{right:10px;bottom:10px;position:fixed;cursor:pointer;}

</style>

 

<body>

 

<input type="button" value="go_top" class="go_top">

 

</body>

 

</html>

<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>

 

<script>

 

 $(function(){

  //回到顶端按钮点击的时候

   $('.go_top').click(function(){

     //给 body html 绑定动画,设置滚动条距离为0 速度为300毫秒

     $('body,html').animate({scrollTop:0}, 300);

  

   })

 

 });

 

</script>

 

转载于:https://www.cnblogs.com/zion0707/p/3889396.html

你可能感兴趣的文章
Python学习02 列表 List
查看>>
[DOM Event Learning] Section 3 jQuery事件处理基础 on(), off()和one()方法使用
查看>>
python爬虫-淘宝商品密码(图文教程附源码)
查看>>
centos6.3下如何搭建LAMP环境
查看>>
C#的一些基础内容
查看>>
nodejs概述
查看>>
H3C PAP验证配置示例
查看>>
oracle-Dbca数据库模板
查看>>
ionic 轮播
查看>>
Faster-RCNN Pytorch实现的minibatch包装
查看>>
[LeetCode] 168. Excel Sheet Column Title_Easy tag: Math
查看>>
[Ionic] Build and Run an Ionic App from Scratch
查看>>
纯手写wcf代码,wcf入门,wcf基础教程
查看>>
关于8.0.15版本的mysql下载与安装
查看>>
Redis主从复制看这篇就够了
查看>>
部署和调优 2.3 tomcat中JDK安装
查看>>
洛谷 P1202 [USACO1.1]黑色星期五Friday the Thirteenth 题解
查看>>
(4.20)SQL Server数据库启动过程,以及启动不起来的各种问题的分析及解决技巧...
查看>>
基本数据类型(数字和字符串)
查看>>
函数__装饰器
查看>>