使用引导程序的工具提示中的图像?
<button title="Tooltip on right" data-placement="right" data-toggle="tooltip" class="btn btn-default mrs" type="button">Tooltip on right</button>
<script>
$(function () {
$('[data-toggle=tooltip]').tooltip();
});
</script>
这很好用,但我想在工具提示中包含一张图片和一些文字.我尝试使用 data-content="some stuff" 但它什么也没显示.
This works fine but I'd like to include an image and some text inside the tooltip. I tried to use data-content="some stuff" but it shows nothing.
推荐答案
你必须在初始化.tooltip时传入html选项.例如
You have to pass in the html option to when you initialize .tooltip. e.g.
<div class="cart">
<a data-toggle="tooltip" title="<img src='http://getbootstrap.com/apple-touch-icon.png' />">
<i class="icon-shopping-cart"></i>
</a>
$('a[data-toggle="tooltip"]').tooltip({
animated: 'fade',
placement: 'bottom',
html: true
});
查看示例fiddle
相关文章