一般tips都是文字,这个可以支持图片,很漂亮:

 
<script type="text/javascript">   

    // Load this script once the document is ready
$(document).ready(function () { // Get all the thumbnail
$('div.thumbnail-item').mouseenter(function(e) { // Calculate the position of the image tooltip
x = e.pageX - $(this).offset().left;
y = e.pageY - $(this).offset().top; // Set the z-index of the current item,
// make sure it's greater than the rest of thumbnail items
// Set the position and display the image tooltip
$(this).css('z-index','15')
.children("div.tooltip")
.css({'top': y + 10,'left': x + 20,'display':'block'}); }).mousemove(function(e) { // Calculate the position of the image tooltip
x = e.pageX - $(this).offset().left;
y = e.pageY - $(this).offset().top; // This line causes the tooltip will follow the mouse pointer
$(this).children("div.tooltip").css({'top': y + 10,'left': x + 20}); }).mouseleave(function() { // Reset the z-index and hide the image tooltip
$(this).css('z-index','1')
.children("div.tooltip")
.animate({"opacity": "hide"}, "fast");
}); }); </script>

CSS文件如下:

<style>   

.thumbnail-item {
/* position relative so that we can use position absolute for the tooltip */
position: relative;
float: left;
margin: 0px 5px;
} .thumbnail-item a {
display: block;
} .thumbnail-item img.thumbnail {
border:3px solid #ccc;
} .tooltip {
/* by default, hide it */
display: none;
/* allow us to move the tooltip */
position: absolute;
/* align the image properly */
padding: 8px 0 0 8px;
} .tooltip span.overlay {
/* the png image, need ie6 hack though */
background: url(images/overlay.png) no-repeat;
/* put this overlay on the top of the tooltip image */
position: absolute;
top: 0px;
left: 0px;
display: block;
width: 350px;
height: 200px;
}
</style>

HTML代码:

<div class="thumbnail-item">
<a href="#"><img src="data:images/small1.jpg" class="thumbnail"/></a>
<div class="tooltip">
<img src="data:images/big1.jpg" alt="" width="330" height="185" />
<span class="overlay"></span>
</div>
</div> <div class="thumbnail-item">
<a href="#"><img src="data:images/small2.jpg" class="thumbnail"/></a>
<div class="tooltip">
<img src="data:images/big2.jpg" alt="" width="330" height="185" />
<span class="overlay"></span>
</div>
</div> <div class="thumbnail-item">
<a href="#"><img src="data:images/small3.jpg" class="thumbnail"/></a>
<div class="tooltip">
<img src="data:images/big3.jpg" alt="" width="330" height="185" />
<span class="overlay"></span>
</div>
</div>

jQuery制作鼠标经过显示图片大图,生成图片tips效果的更多相关文章

  1. 杠杠做的全屏随鼠标滚动显示图片,类似于PPT效果

    图片有22张,是一张张加载的,耐心点,鼠标一直尝试向下滚就行了. 图片来自<天空之境:乌尤尼盐沼>,一个好美好美的地方 引个流,欢迎去我的博客看看:http://blog.cxycs.co ...

  2. jQuery实现鼠标划过展示大图的方法

    这篇文章主要介绍了jQuery实现鼠标划过展示大图的方法,实例分析了jQuery操作鼠标事件及图片处理的技巧,具有一定参考借鉴价值,需要的朋友可以参考下 本文实例讲述了jQuery实现鼠标划过展示大图 ...

  3. jQuery实现鼠标悬停显示提示信息窗口的方法

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  4. jQuery - 制作点击显示二级菜单效果

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  5. JS实现 鼠标放上去 图片自动放大的效果

    前段时间做项目,要实现,一张图片,鼠标放上去图片自动变大的效果,虽然难度不大,但当时也想了一段时间,当时没时间记录一下,现在有时间了,写篇博客把代码给记录一下: 效果如下: 代码如下: <!DO ...

  6. wpf image控件循环显示图片 以达到动画效果 问题及解决方案

    1>最初方案: 用wpf的image控件循环显示图片,达到动画效果,其实就是在后台代码动态改变Image.Source的值,关键代码: ; i < ; i++)//六百张图片 { Bitm ...

  7. jQuery实现鼠标移入切换图片

    初始效果: 鼠标移入效果: 首先添加jQuery库,我这边直接引用百度CDN地址 <script src="https://apps.bdimg.com/libs/jquery/2.1 ...

  8. jquery easyui鼠标右击显示自定义的菜单

    1.datagrid表格中,对某一行鼠标右击,显示出如下的自定义的菜单: 在html页面中写: <div id="menu" class="easyui-menu& ...

  9. Qt5制作鼠标悬停显示Hint的ToolTip

    在日常生活中的使用的软件中,我们经常会遇到这样的情况. 我们在网页上,有些网页链接的文字(比如文章标题,知乎问题标题,百度的词条等)因为太长了,而显示不出来,但是鼠标悬停在上面的时候就可以显示出来.  ...

随机推荐

  1. 补发9.27“天天向上”团队Scrum站立会议

    组长:王森 组员:张金生 张政 栾骄阳 时间:2016.09.27 地点:612寝 组员 已完成 未完成 王森 分析设计亮点 原型搭建 张金生 设计UI框架 美化完善 张政 学习C#语言初步应用 熟练 ...

  2. mysql只修改年月日,时分秒不变

    比如时间为 “2014-12-11 13:12:01”修改为“2014-09-26 13:12::01”修改内容为修改yyyy-mm-dd为对应的日期,时间不变.UPDATE result_road_ ...

  3. php htmlentities和htmlspecialchars 的区别

    很多人都以为htmlentities跟htmlspecialchars的功能是一样的,都是格式化html代码的,我以前也曾这么认为,但是今天我发现并不是这样的.   The translations ...

  4. ACM数论之旅2---快速幂,快速求a^b((ノ`Д´)ノ做人就要坚持不懈)

    a的b次方怎么求 pow(a, b)是数学头文件math.h里面有的函数 可是它返回值是double类型,数据有精度误差 那就自己写for循环咯 LL pow(LL a, LL b){//a的b次方 ...

  5. 静态属性加载到jvm时候就存放在数据共享区,而不是等new后出现

    静态属性加载到jvm时候就存放在数据共享区,而不是等new后出现.他的生命周期是 jvm结束 才会消失,一般的方法属性是对象结束后 就会消失.

  6. Spanning Tree Protocol (STP) in NetScaler Appliance

    Spanning Tree Protocol (STP) in NetScaler Appliance 来源 https://support.citrix.com/article/CTX112341 ...

  7. MT【143】统一分母

    已知$a,b>0$,则$m=\dfrac{b^2+2}{a+b}+\dfrac{a^2}{ab+1}$的最小值是______ 解答: $$m\geqslant \dfrac{b^2+2}{\sq ...

  8. (转)enable_from_this方法的使用与陷阱

    转自http://blog.chinaunix.net/uid-442138-id-2122464.html   enable_from_this 的使用与实现原理说明:   shared_from_ ...

  9. 【刷题】BZOJ 5415 [Noi2018]归程

    www.lydsy.com/JudgeOnline/upload/noi2018day1.pdf Solution 考试的时候打的可持久化并查集,没调出来QAQ 后面知道了kruskal重构树这个东西 ...

  10. 一次绕过防火墙获取RCE以及提权到root权限的渗透过程

    本文是关于Apache struts2 CVE-2013-2251是由于导致执行远程命令的影响而被高度利用的漏洞.简而言之, 通过操纵以“action:”/”redirect:”/”redirectA ...