“data-api”的含义是什么?在Twitter Bootstrap的Tab插件中 [英] What's the meaning of "data-api" in Twitter Bootstrap's Tab plugin

查看:108
本文介绍了“data-api”的含义是什么?在Twitter Bootstrap的Tab插件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一段代码

/* TAB DATA-API
 * ============ */

 $(function () {
   $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
     e.preventDefault()
     $(this).tab('show')
   })
 })

文件中的

Bootstrap--tab
我不明白'click.tab.data- api''[data-toggle =tab],[data-toggle =pill]'

谁能为我解释一下?谢谢~~

Who could explain it for me? THANKS~~

推荐答案

click.tab.data-api 是使用命名空间'tab.data-api'的单击事件。您可以在此处(事件和名称空间部分)查看文档。

the click.tab.data-api is a click event with Namespace 'tab.data-api'. you can look at the document here (event and namespace section).

如果我没记错的话,data- *是Html5标准中的新自定义数据属性,当您想要定义自己的属性或数据时,它会很方便。查看 John的帖子,解释数据属性。

If I remember correctly, the data-* is a new custom data attribute in Html5 standard, it comes handy when you want to define you own attributes or data. check out John's post explaining data attribute.

这篇关于“data-api”的含义是什么?在Twitter Bootstrap的Tab插件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆