将模态窗口 Bootstrap 滚动到底部 [英] Scrolling of modal window Bootstrap to bottom

查看:45
本文介绍了将模态窗口 Bootstrap 滚动到底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个动态高度(超过屏幕高度)的模态窗口 Bootstrap.如何以编程方式将窗口滚动到底部?我试图这样做:

I have a modal window Bootstrap with dynamic height (more than height of screen). How can I scroll the window to bottom programmatically? I tried to do this:

$('#modal').animate({ scrollTop: $('#modal').height() }, 500);

但是当我调整窗口大小时,变量 $('#modal').height() 没有改变.有什么想法吗?

But variable $('#modal').height() is not changing while I'm resizing window. Any ideas?

推荐答案

解决方案很简单:

$('#modal').animate({ scrollTop: $('#modal .modal-dialog').height() }, 500);

这篇关于将模态窗口 Bootstrap 滚动到底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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