简体   繁体   English

Bootstrap3手风琴崩溃:如何在顶部显示打开的div?

[英]Bootstrap3 accordion collapse: how to show opened div at the top?

I have just implemented bootstrap collapse(accordion) which works very well. 我刚刚实现了bootstrap collapse(accordion),效果非常好。 Every element has huge amount data, so that the data can't show from first 每个元素都有大量数据,因此数据无法从最初显示

Is there any option to show element at the top when open accordion ? 打开手风琴时有没有选项可以在顶部显示元素?

Opened div should be top of the page 打开的div应该是页面的顶部

Demo http://bootply.com/84308 演示http://bootply.com/84308

You could capture the 'shown' event and use jQuery to move the selected panel to the first position in the accordion like this.. 您可以捕获'显示'事件并使用jQuery将选定的面板移动到手风琴中的第一个位置,就像这样。

$('#accordion').on('shown.bs.collapse', function () {

  var openPanel = $(this).find('.in').parents('.panel');
  openPanel.prependTo('#accordion');

});

Demo: http://bootply.com/84308 演示: http//bootply.com/84308

You can add "in" class to your inner div to display data. 您可以在内部div中添加“in”类来显示数据。 recommend you to go through the link http://getbootstrap.com/2.3.2/javascript.html#collapse 建议您浏览http://getbootstrap.com/2.3.2/javascript.html#collapse链接

Please add more details to your problem if this does not helps you. 如果这对您的问题没有帮助,请添加更多详细信息。 Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM