开发者

How do you know how to use twitter-bootstrap?

开发者 https://www.devze.com 2023-04-12 13:51 出处:网络
I can\'t find a complete document. For example, the popover effect(here) will use a DOM\'s data-origin-title attribute as its own title, and data-cotent as its content:

I can't find a complete document. For example, the popover effect(here) will use a DOM's data-origin-title attribute as its own title, and data-cotent as its content:

$('#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")

Where to learn it? The offcial document doesn't have data-origin-title attribute. Neither in source code of bootstrap-popover.js开发者_开发百科.


All you need is right up there in the Options table. It grabs the title attribute for the title, and data-content for the content (3rd column). The data-original-title you see on the HTML is added by the plugin script after executing, ignore it.

The idea for this is that you already have the info on the HTML:

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

So your script only does this, you don't need to handle events:

$('#mything').popover()
0

精彩评论

暂无评论...
验证码 换一张
取 消