javascript - 你怎么知道如何使用 twitter-bootstrap?

标签 javascript jquery coffeescript twitter-bootstrap

我找不到完整的文档。例如,popover 效果 ( here ) 将使用 DOM 的 data-origin-title 属性作为其自己的标题,并使用 data-cotent 作为其内容:

$('#somedom').hover (->
    $(this).addClass("hover")
    $(this).attr("data-original-title","Location")
    $(this).attr("data-content":'The popover plugin provides a simple interface for adding popovers to your appli    cation. It extends the bootstrap-twipsy.js plugin, 
                so be sure to grab that file as well when including popovers in your project!')
    $(this).popover({})
    $(this).popover("show")
    ),->
        $(this).removeClass("hover")

哪里可以学?官方文档没有 data-origin-title 属性。 bootstrap-popover.js 的源代码中都没有。

最佳答案

您需要的一切就在选项表格中。它获取标题的 title 属性,获取内容的 data-content 属性(第三列)。您在 HTML 上看到的 data-original-title 是插件脚本执行后添加的,请忽略它。

这样做的想法是您已经拥有 HTML 上的信息:

<div id="mything" title="My title=" data-content="Some text here">Test popover</div>

所以你的脚本只做这个,你不需要处理事件:

$('#mything').popover()

关于javascript - 你怎么知道如何使用 twitter-bootstrap?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7716073/

相关文章:

jQuery Datepicker onClose 选择下一个

javascript - 获取 CoffeeScript 对象的所有实例方法

javascript - 如何在 CoffeeScript 中导入 javascript 库?

javascript - "?:^"正则表达式是什么意思?

php - 预订过程中的电子邮件 ID 捕获

javascript - 将选择的(单击的)选项传递到输入框

javascript - 为什么我的 View 事件没有触发?

javascript - 检查 JavaScript 对象是 Map 还是 Set (ECMAScript 2015)

javascript - 删除跨度之间的空白

javascript - 附加 ul - JQuery