The data-toggle attributes in Twitter Bootstrap

后端 未结 10 1415
我寻月下人不归
我寻月下人不归 2020-11-30 16:58

What does data-toggle attributes do in Twitter Bootstrap? I couldn\'t find an answer in Bootstrap API.

I have seen a similar question before as well, li

10条回答
  •  独厮守ぢ
    2020-11-30 17:04

    So many answers have been given, but they don't get to the point. Let's fix this.

    http://www.w3schools.com/bootstrap/bootstrap_ref_js_collapse.asp

    To the point

    1. Any attribute starting with data- is not parsed by the HTML5 parser.
    2. Bootstrap uses the data-toggle attribute to create collapse functionality.

    How to use: Only 2 Steps

    1. Add class="collapse" to the element #A you want to collapse.
    2. Add data-target="#A" and data-toggle="collapse".

    Purpose: the data-toggle attribute allows us to create a control to collapse/expand a div (block) if we use Bootstrap.

提交回复
热议问题