简体   繁体   English

为什么我无法在Bootstrap工具提示中显示图像?

[英]Why I'm not able to show the image in Bootstrap tool-tip?

I'm using Bootstrap framework v3.3.0 for my website. 我正在为我的网站使用Bootstrap框架v3.3.0

I want to show on image as a tool-tip when user hovers a mouse pointer over the icon. 当用户将鼠标指针悬停在图标上时,我想在图像上显示为工具提示。 For it I'm having following HTML : 为此,我有以下HTML:

<div class="col-sm-5">
  <div class="input-group">  
    <input type="text" class="form-control" name="trans_id" id="trans_id"/>
    <span class="input-group-addon">
      <a href="#" class="glyphicon glyphicon-question-sign" rel="tooltip" data-html="true" title="localhost/img/demo_img.png"></a>    
    </span>
  </div>
</div>

jQuery code is as follows : jQuery代码如下:

$(document).ready(function() {
  $('.input-group-addon').tooltip({
    selector: "a[rel=tooltip]"
  })
});

On hovering I'm not able to display the image. 悬停时,我无法显示图像。 Now the text I mentioned in title(ie The complete image location path is displayed as a tool -tip.) 现在我在标题中提到的文本(即完整的图像位置路径显示为工具提示)。

All the necessary CSS and jQuery files are included. 包含所有必需的CSS和jQuery文件。

Please help me in this regard. 请在这方面帮助我。

Thanks in advance. 提前致谢。

The html parameter is a boolean, so you need to set it to true with html参数是一个布尔值,因此您需要将其设置为true

<a data-html="true" ...etc... >

Then you need to use the title to supply yout HTML content: 然后,您需要使用标题来提供HTML内容:

<a data-html="true" title="<img src='...' />" ...etc... >

Bootstrap 3 docs for this are here: 此处提供了Bootstrap 3文档:

http://getbootstrap.com/javascript/#tooltips-usage http://getbootstrap.com/javascript/#tooltips-usage

jsfiddle example here: jsfiddle示例在这里:

http://jsfiddle.net/sifriday/7s81L84m/ http://jsfiddle.net/sifriday/7s81L84m/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM