我不是程序员,但我使用下面的代码将页面滚动到顶部。
我如何调整它使其向下滚动?
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<a class="btnMedio" href="javascript:;">
<img src="http://desmond.imageshack.us/Himg41/scaled.php?server=41&filename=deixeseuemail.png&res=landing"/>
</a>
<script>
$('.btnMedio').click(function(){
$('html, body').animate({scrollTop:1000},'50');
});
</script>
发布于 2012-09-29 13:24:51
$('.btnMedio').click(function(event) {
// Preventing default action of the event
event.preventDefault();
// Getting the height of the document
var n = $(document).height();
$('html, body').animate({ scrollTop: n }, 50);
// | |
// | --- duration (milliseconds)
// ---- distance from the top
});
发布于 2012-09-29 13:34:17
试试这个:
window.scrollBy(0,180); // horizontal and vertical scroll increments
发布于 2013-03-13 00:24:13
这可以用来解决这个问题。
<div id='scrol'></div>
在javascript中使用以下代码
jQuery("div#scrol").scrollTop(jQuery("div#scrol")[0].scrollHeight);
https://stackoverflow.com/questions/12650170
复制相似问题