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

Posted

技术标签:

【中文标题】你怎么知道如何使用 twitter-bootstrap?【英文标题】:How do you know how to use twitter-bootstrap? 【发布时间】:2011-12-04 16:33:00 【问题描述】:

我找不到完整的文档。例如,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的源代码中都没有。

【问题讨论】:

【参考方案1】:

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

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

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

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

$('#mything').popover()

【讨论】:

以上是关于你怎么知道如何使用 twitter-bootstrap?的主要内容,如果未能解决你的问题,请参考以下文章