【问题标题】:Can I add a "Like" Button in Twitter's Bootstrap Popover?我可以在 Twitter 的 Bootstrap Popover 中添加“Like”按钮吗?
【发布时间】:2012-10-23 08:58:04
【问题描述】:

我有一个按钮,点击后会弹出一个弹出框(就像这里的现场演示:http://twitter.github.com/bootstrap/javascript.html#popovers

现在我想在弹出框的内容字段中添加一个简单的点赞按钮。那可能吗?目前,弹出框仅将链接显示为文本“http://test.com

目前:

<a href="#" id="example" rel="popover" data-content="http://test.com" data-original-title="Like"><img src="img/specialbutton.png"></a>

【问题讨论】:

    标签: twitter-bootstrap popover


    【解决方案1】:

    我不完全确定您所说的“赞”按钮是什么意思。为了在弹出框上放置一个带有锚文本“like”的按钮和一个指向“http://test.com”的链接:

    1 从您的 &lt;a&gt;-tag 中删除所有 data-xxx 引用

    <a href="#" id="example" rel="popover"><img src="img/specialbutton.png"></a>
    

    2 像这样调用弹出框

    $('#example').popover({
      placement: 'right',
      title: 'Like this website?',
      html: true,
      content: '<button class="btn"><a href="http://test.com">Like</a></button>'
    });
    

    您可以在content 中放置多种类型的 HTML 标记,也许您想要一组用于各种社交媒体的按钮?如果你想添加一个 facebook 按钮,你必须遵循 guidelines 并在内容中插入从那里生成的代码

    【讨论】:

    • @davidkonrad 我们如何在 jquery 中获取上述按钮点击事件?
    猜你喜欢
    • 2015-04-02
    • 2012-01-19
    • 2012-03-11
    • 1970-01-01
    • 2016-05-01
    • 2015-10-24
    • 1970-01-01
    • 2018-11-30
    • 2012-11-02
    相关资源
    最近更新 更多