jQuery点击跳转到指定位置


<html>
<head>
<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#btn1").click(function(){
var scrollHeight = $('#div1').prop("scrollHeight");
$('#div1').scrollTop(scrollHeight,200);
});
});
</script>
</head>
<body>
<div id="div1" style="border:1px solid black;width:200px;height:200px;overflow:auto">
第1行<br>第2行<br>第3行<br>第4行<br>第5行<br>
第6行<br>第7行<br>第8行<br>第9行<br>第10行<br>
第11行<br>第12行<br>第13行<br>第14行<br>第15行<br>
第16行<br>第17行<br>第18行<br>第19行<br>第20行
</div>
<button id="btn1">移动到最底部</button>
</body>
</html>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM