问题
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.
The problem is that I get a flash of all the content before the .collapse()
is initialized.
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.
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)?
Here's a fiddle to play with: http://jsfiddle.net/DHZNv/44/
Thanks!
回答1:
Is this the behavior you want?
http://jsfiddle.net/DHZNv/45/
来源:https://stackoverflow.com/questions/11164172/bootstrap-collapse-and-flash-of-unhidden-content