The data-toggle attributes in Twitter Bootstrap

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

    Any attribute that starts with data- is the prefix for custom attributes used for some specific purpose (that purpose depends on the application). It was added as a semantic remedy to people's heavy use of rel and other attributes for purposes other than their original intended purposes (rel was often used to hold data for things like advanced tooltips).

    In the case of Bootstrap, I'm not familiar with its inner workings, but judging from the name, I'd guess it's a hook to allow toggling of the visibility or perhaps a mode of the element it's attached to (such as the collapsable side bar on Octopress.org).

    html5doctor has a good article on the data- attribute.

    Cycle 2 is another example of extensive use of the data- attribute.

提交回复
热议问题