How to display pop up text on mouse hover?

2019-03-16 11:34发布

I want to load some content from a DIV tag as pop up text when i hover over an image. When i mouse leave from that image pop should disappear and when i again mouse over image content should show as pop up text. I am using HTML, Jquery, JS for this. It will be very useful if i get a solution using jquery load() method. Let me know ur response.

4条回答
在下西门庆
2楼-- · 2019-03-16 11:48

You can add the title attribute to the image. You don't need any extra tags or styling, just an attribute.

查看更多
聊天终结者
3楼-- · 2019-03-16 11:51

Or, without javascript:

<div class="tooltip-wrap">
  <img src="/some/image/file.jpg" alt="Some Image" />
  <div class="tooltip-content">
    <p>Here is some content for the tooltip</p>
  </div> 
</div>

And this CSS:

.tooltip-wrap {
  position: relative;
}
.tooltip-wrap .tooltip-content {
  display: none;
  position: absolute;
  bottom: 5%;
  left: 5%;
  right: 5%;
  background-color: #fff;
  padding: .5em;
}
.tooltip-wrap:hover .tooltip-content {
  display: block;
}
查看更多
霸刀☆藐视天下
4楼-- · 2019-03-16 11:57

You can use Twitter Bootstrap with the tooltip plugin.

If you want just the plugin, you can build your own Bootstrap with the plugin only.

Finally if you want to stylize your tooltip, use CSStooltip.com.

Example :

enter image description here

span.tooltip:after {
      content: "";
      position: absolute;
      width: 0;
      height: 0;
      border-width: 10px;
      border-style: solid;
      border-color: transparent #FFFFFF transparent transparent;
      top: 11px;
      left: -24px;
}
查看更多
趁早两清
5楼-- · 2019-03-16 12:01

You could also try something very simple like:

<acronym title="pop-up text"><img src=...></acronym>
查看更多
登录 后发表回答