使用Jquery自动向下滚动? [英] Automatically scroll down with Jquery?

查看:120
本文介绍了使用Jquery自动向下滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个定义高度的模态框。在这个盒子里面有一个手风琴盒,当用户点击一个链接时,它展开。手风琴盒在切换时的高度超过模态框的高度,因此出现滚动条。

I have a modal box with a defined height. Inside of this box there is an accordion box that expands when a user clicks a link. The height of the accordion box when it is toggled exceeds the height of the modal box and thus a scrollbar appears.

我想自动将栏向下滚动到最低点,以便在折叠框中显示新内容。

I would like to automatically scroll the bars down to its lowest point to display the new content in the accordion box.

手风琴盒的外观如下:

<script type="text/javascript"> 
$(document).ready(function(){
$(".btn-slide").click(function(){
$("#panel").slideToggle("slow");
$(this).toggleClass("active"); return false;
});
});
</script> 

有没有办法将此向下滚动函数集成到现有函数中?这种类型的行为是否有现有的Jquery函数?

Is there a way to integrate this scroll down function into the existing function? Is there an existing Jquery function for this type of behavior?

推荐答案

如果你不想依赖任何插件,更改实际网址,您可以使用scrollTop,请参阅 http://api.jquery.com/scrollTop/

If you don't want to rely on any plugin, or change the actual URL, you could use scrollTop, see http://api.jquery.com/scrollTop/

干杯。

这篇关于使用Jquery自动向下滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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