实现效果:当鼠标指向商品图片时,图片会自动放大。

      

 <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>文字放大</title> <script type="text/javascript" src="../../scripts/jquery-1.7.2.js"></script>
<style type="text/css">
body{
margin:0;
padding:40px;
background:#fff;
font:80% Arial, Helvetica, sans-serif;
color:#555;
line-height:180%;
}
img{border:none;}
ul,li{
margin:0;
padding:0;
}
li{
list-style:none;
float:left;
display:inline;
margin-right:10px;
border:1px solid #AAAAAA;
} /* tooltip */
#tooltip{
position:absolute;
border:1px solid #ccc;
background:#333;
padding:2px;
display:none;
color:#fff;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
var x =10;
var y =20;
$("a.tooltip").mouseover(function(e){
this.myTitle = this.title;
this.title="";
var imgTitle=this.myTitle?"<br/>"+this.myTitle:"";
var tooltip = "<div id='tooltip'><img src=' "+this.href+"' alt='产品预览图'/>"+imgTitle+"</div>";
$("body").append(tooltip); $("#tooltip").css({
"top":(e.pageY+y)+"px",
"left":(e.pageX+x)+"px"
})
.show("fast");
}).mouseout(function(){
this.title=this.myTitle;
$("#tooltip").remove();
}).mousemove(function(e){
$("#tooltip")
.css({
"top": (e.pageY+y) + "px",
"left": (e.pageX+x) + "px"
});
});
});
</script>
</head>
<body>
<h2>图片放大</h2>
<ul>
<li>
<p><a href="images/apple_1_bigger.jpg" class="tooltip" title="苹果iPod"><img src="data:images/apple_1.jpg" alt="苹果iPod"></a></p>
</li>
<li>
<p><a href="images/apple_2_bigger.jpg" class="tooltip" title="苹果iPod nano"><img src="data:images/apple_2.jpg" alt="苹果iPod nano"></a></p>
</li>
<li>
<p><a href="images/apple_3_bigger.jpg" class="tooltip" title="苹果iPhone"><img src="data:images/apple_3.jpg" alt="苹果iPhone"></a></p>
</li>
<li>
<p><a href="images/apple_4_bigger.jpg" class="tooltip" title="苹果 Mac"><img src="data:images/apple_4.jpg" alt="苹果 Mac"></a></p>
</li>
</ul>
</body>
</html>

jQuery实现网站图片放大效果的更多相关文章

  1. magento中如何实现产品图片放大效果

    Magento列表页用jQuery实现产品图片放大效果今天看到个网站,鼠标移到列表页的产品图片上,旁边会弹出一个大图,感觉不错,就自己在Magento里写了个.先看看效果 这个效果比较好实现,打开li ...

  2. jquery图片放大插件鼠标悬停图片放大效果

    都知道jquery都插件是非常强大的,最近分享点jquery插件效果,方便效果开发使用. 一.HTML代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHT ...

  3. 为BlueLake主题增加图片放大效果

    fancyBox 是一个流行的媒体展示增强组件,可以方便为网站添加图片放大.相册浏览.视频弹出层播放等效果.优点有使用简单,支持高度自定义,兼顾触屏.响应式移动端特性,总之使用体验相当好. 现在,我们 ...

  4. js图片放大效果

    实现购物网站里的图片放大效果,jqzoom很好用.今天才接触它,很快就上手了.看了一个示例,在放大图像上方貌似有水印,后经排查,原来是图片的标题,然后设置title为false,搞定.

  5. jQuery鼠标悬停图片放大显示

    jQuery鼠标悬浮放于图片上之后图片放大显示的效果,即鼠标移到图片上图片突出显示,鼠标移开后恢复原来的模样,你可以在图片滚动效果中加上本特效,相信会更炫一些. <!DOCTYPE html P ...

  6. ASP.NET中使用jQuery插件实现图片幻灯效果

    参照网上的资料及提供的jQuery插件实现图片幻灯效果. 1.页面前台代码: //头部引用 <head runat="server"><title>< ...

  7. 一款基于jquery的手风琴图片展示效果

    今天要给大家分享一款基于jquery的手风琴图片展示效果.这款图片的展示效果鼠标经过前是灰色的,当鼠标经过时图片变大且变为彩色.效果图如下: 在线预览   源码下载 实现的代码. html代码: &l ...

  8. jQuery仿迅雷图片轮换效果

    jQuery仿迅雷图片轮换效果 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "ht ...

  9. jQuery点击图片放大拖动查看效果

    效果如图: 放大前: 放大后(可拖动图片浏览): 源码如下: <html xmlns="http://www.w3.org/1999/xhtml"> <head& ...

随机推荐

  1. 【题解】【链表】【Leetcode】Add Two Numbers

    You are given two linked lists representing two non-negative numbers. The digits are stored in rever ...

  2. Install Fastx (zz)

    Fastx-toolkit installation on CentOS ===================================== Tested on CentOS release ...

  3. 右键菜单添加程序,指定图标, Notepad2、Sublime Text 2

    右键添加Sublime Text 打开方式 Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\Sublime Text] ...

  4. 199. Binary Tree Right Side View

    Given a binary tree, imagine yourself standing on the right side of it, return the values of the nod ...

  5. 一个textview实现文字在图片上面的效果

    类似于这样的,其实很简单,可是以前用的是imageview+textview.布局实现多写了好多代码.又不能在图片加文字,显得没技术含量. xml代码如下: <TextView android: ...

  6. css selector

    文章一: http://www.jb51.net/css/68287.html 去年我学jQuery的时候,曾经做过一点选择器(selector)的笔记,今天是CSS的选择器,以后还有一部分xPath ...

  7. tyvj1012 P1012 - 火柴棒等式 ——暴力枚举

    题目链接:https://www.tyvj.cn/Problem_Show.aspx?id=1012 可以发现:最大的数字绝对不超过999,只要枚举出0-999所有数字需要的火柴数,然后再枚举C和A, ...

  8. Hive 复习

    hive分为CLI(command line)(用的比较多) JDBC/ODBC-ThriftServer hiveServer(hive -service hiveserver),JDBC访问,一个 ...

  9. caffe: compile error: Could not open or find file your path~~/resized_data/0 and a total of 2 images .

    I0219 14:48:40.965386 31108 net.cpp:76] Memory required for data: 0I0219 14:48:40.965517 31108 layer ...

  10. Tensorflow ——神经网络

    Training Data Eval: Num examples: 55000 Num correct: 52015 Precision @ 1: 0.9457Validation Data Eval ...