bootstrap initially collapsed element

前端 未结 8 913
长发绾君心
长发绾君心 2020-12-15 02:29

I am using the bootstrap template and I would like to change the way the accordion works by default.

How can I get the toggle to be closed when page is first seen (u

相关标签:
8条回答
  • 2020-12-15 03:12

    You need to remove "in" from "collapse in"

    0 讨论(0)
  • another solution is to add toggle=false to the collapse target, this will stop it randomly opening and closing which happens if you just remove the "in"

    eg

    <div class="accordion-heading">
        <a class="accordion-toggle"
            data-toggle="collapse"
            data-parent="#accordion2"
            href="#collapseOne">Open!</a>
    </div>
    <div
        id="collapseOne"
        class="accordion-body collapse"
        data-toggle="false"
        >
        <div class="span6">
            <div class="well well-small">
                <div class="accordion-toggle">
                    ...some text...
                </div>
            </div>
        </div>
        <div class="span2"></div>                            
    </div>
    
    0 讨论(0)
提交回复
热议问题