Bootstrap crash()和未隐藏内容的闪烁 [英] Bootstrap collapse() and flash of unhidden content

查看:118
本文介绍了Bootstrap crash()和未隐藏内容的闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Twitter Bootstrap框架,我正在使用$('#foo').collapse()制作具有可折叠答案的FAQ,这些答案默认情况下是隐藏的,当您单击问题时即可看到.

Using Twitter Bootstrap framework, I'm using $('#foo').collapse() to make an FAQ with collapsable answers that are hidden by default, and then visible when you click the question.

问题是在初始化.collapse()之前,我得到了所有内容的闪光.

The problem is that I get a flash of all the content before the .collapse() is initialized.

我无法提前隐藏内容(通过display: none),否则折叠功能不知道盒子的高度,并且折叠/展开不起作用.

I can't hide the content in advance (via display: none), otherwise the collapse function doesn't know the height of the boxes and collapsing/expanding doesn't work.

我认为,如果$('#foo').collapse()不对初始折叠进行动画处理,而只是立即隐藏元素,则可以解决此问题.关于如何执行此操作(或其他解决方案)的任何想法?

I think this could be solved if $('#foo').collapse() didn't animate the initial collapse, and just instantly hid the elements. Any idea on how to do that (or other solutions)?

这是一个玩弄的小提琴: http://jsfiddle.net/DHZNv/44/

Here's a fiddle to play with: http://jsfiddle.net/DHZNv/44/

谢谢!

推荐答案

这是您想要的行为吗?

http://jsfiddle.net/DHZNv/45/

这篇关于Bootstrap crash()和未隐藏内容的闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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