点击按钮-滚动条处于页面或者(div)的底部
2015-11-05 22:05
330 查看
<!DOCTYPE html>
<html>
<head>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("div").scrollTop($("div")[0].scrollHeight);
// alert($("div").scrollTop()+" px");
});
});
</script>
</head>
<body>
<div style="border:1px solid black;width:100px;height:150px;overflow:auto">
This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text.</div><br>
<button>Return the vertical position of the scrollbar</button>
<p>Move the scrollbar down and click the button again.</p>
</body>
</html>
<html>
<head>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("div").scrollTop($("div")[0].scrollHeight);
// alert($("div").scrollTop()+" px");
});
});
</script>
</head>
<body>
<div style="border:1px solid black;width:100px;height:150px;overflow:auto">
This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text.</div><br>
<button>Return the vertical position of the scrollbar</button>
<p>Move the scrollbar down and click the button again.</p>
</body>
</html>
相关文章推荐
- cdq分治模板
- Hibernate不能使用@Table和@JoinColumn的问题
- Java 继承 不允许继承的类 不可变的类 final class
- LeetCode Combinations (DFS)
- 创建多线程类
- HDOJ 题目3001Travelling(三进制状压DP,TSP)
- JQuery 跨域访问
- angularjs初窥门径
- PLAYGROUND 可视化
- [leetcode] Remove Invalid Parentheses
- Ceph mon一个故障案例的处理
- [LeetCode] Game of Life
- shell监控MySQL服务是否正常
- poj--3207--Ikki's Story IV - Panda's Trick(2-sat)
- Centos7无法使用ssh登陆及解决方案
- spring mvc 表单提交,试过可用
- 单例模式的七种写法
- 异步选择模型WSAAsyncSelect
- 卷积神经网络学习笔记(一)
- 【Android开发—智能家居系列】(四):UDP通信发送指令