The data-toggle attributes in Twitter Bootstrap

后端 未结 10 1424
我寻月下人不归
我寻月下人不归 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:19

    It is a Bootstrap data attribute that automatically hooks up the element to the type of widget it is. Data-* is part of the html5 spec, and data-toggle is specific to Bootstrap.

    Some Examples:

    data-toggle="modal"
    data-toggle="collapse"
    data-toggle="dropdown"
    data-toggle="tab"
    

    Go through the Bootstrap JavaScript docs and search for data-toggle and you will see it used in the code examples.

    One working example:

提交回复
热议问题