jquery图片放大插件鼠标悬停图片放大效果
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery图片放大插件鼠标滑过图片放大效果</title>
<meta name="description" content="jquery图片放大插件制作一个当鼠标滑过图片,图片按等比例缩放放大效果。动画图片放大展示特效。jQuery插件。" />
</head>
<body>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery.zoomImgRollover.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#testimg").zoomImgRollover();
});
</script>
<style type="text/css">
*{margin:0;padding:0;list-style-type:none;}
a,img{border:0;}
.demo{width:544px;margin:20px auto;}
</style>
<div class="demo">
<a href='http://www.3mooc.com/' style="border:1px solid #000;">
<img id="testimg" width="400" height="564" src="data:images/132ad.jpg" alt="" border="0">
</a>
</div>
</body>
</html>
(function(jQuery){
jQuery.fn.zoomImgRollover = function(options) {
var defaults = {
percent:30,
duration:600
};
var opts = jQuery.extend(defaults, options);
// static zoom function
function imageZoomStep(jZoomImage, x, origWidth, origHeight)
{
var width = Math.round(origWidth * (.5 + ((x * opts.percent) / 200))) * 2;
var height = Math.round(origHeight * (.5 + ((x * opts.percent) / 200))) * 2;
var left = (width - origWidth) / 2;
var top = (height - origHeight) / 2;
jZoomImage.css({width:width, height:height, top:-top, left:-left});
}
return this.each(function()
{
var jZoomImage = jQuery(this);
var origWidth = jZoomImage.width();
var origHeight = jZoomImage.height();
// add css ness. to allow zoom
jZoomImage.css({position: "relative"});
jZoomImage.parent().css({overflow: "hidden", display:"block", position: "relative", width: origWidth, height: origHeight});
jZoomImage.mouseover(function()
{
jZoomImage.stop().animate({dummy:1},{duration:opts.duration, step:function(x)
{
imageZoomStep(jZoomImage, x, origWidth, origHeight)
}});
});
jZoomImage.mouseout(function()
{
jZoomImage.stop().animate({dummy:0},{duration:opts.duration, step:function(x)
{
imageZoomStep(jZoomImage, x, origWidth, origHeight)
}});
});
});
};
})(jQuery);
jquery图片放大插件鼠标悬停图片放大效果的更多相关文章
- jquery.imagezoom.js制作鼠标悬停图片放大镜特效、参数和最简教程
一.插件介绍 今天在用到放大镜效果的时候,突然发现网站里没有放大镜的插件.于是总结了一下,放到这里.为自己,也为他人提供方便.jquery.imagezoom.js这款插件用途很简单,就是鼠标移过去, ...
- 使用 jQuery 操作页面元素的方法,实现浏览大图片的效果,在页面上插入一幅小图片,当鼠标悬停到小图片上时,在小图片的右侧出现与之相对应的大图片
查看本章节 查看作业目录 需求说明: 使用 jQuery 操作页面元素的方法,实现浏览大图片的效果,在页面上插入一幅小图片,当鼠标悬停到小图片上时,在小图片的右侧出现与之相对应的大图片 实现思路: 在 ...
- jQuery css3鼠标悬停图片显示遮罩层动画特效
jQuery css3鼠标悬停图片显示遮罩层动画特效 效果体验:http://hovertree.com/texiao/jquery/39/ 效果图: 源码下载:http://hovertree.co ...
- CSS3鼠标悬停图片上浮显示描述代码
效果:http://hovertree.com/texiao/css3/20/ 效果图: 代码如下: <!doctype html> <html lang="zh" ...
- HTML5+CSS3鼠标悬停图片特效
点击预览效果 下载该特效: HTML5+CSS3鼠标悬停图片特效.zip 特效说明: 一款HTML5+CSS3鼠标悬停图片事件网页特效,集合了最流行鼠标悬停图片文字.图片动画移动 ...
- 15款css3鼠标悬停图片动画过渡特效
分享15款css3鼠标悬停图片动画过渡特效.这是一款15款不同效果的css3 hover动画过渡效果代码.效果图如下: 在线预览 源码下载 实现的代码. html代码: <div class ...
- 基于html5鼠标悬停图片动画展示效果
分享一款基于html5鼠标悬停图片动画展示效果.里面包含两款不同效果的html5图片展示效果.效果图如下: 在线预览 源码下载 实现的代码. html代码: <div class=" ...
- 通过CSS3实现:鼠标悬停图片360度旋转效果
效果很好玩,代码很简单: 效果: 鼠标放置在图片上:360度顺时针旋转 鼠标离开图片:图片260度逆时针旋转 只要将下面代码拷贝过去,并将图片改成你想要的就可以看到效果 <!doctype ht ...
- 利用jQuery无缝滚动插件liMarquee实现图片(链接)和文字(链接)向右无缝滚动(兼容ie7+)
像新闻类的版块经常要求一条条的新闻滚动出现,要实现这种效果,可以使用jQuery无缝滚动插件liMarquee. 注意: 1. 它的兼容性是IE7+,及现代浏览器. 2. 引用的jquery的版本最好 ...
随机推荐
- Java多线程的中断原理和 interrupt() 几个方法简介
上节讲到,线程被 wait() 通知后进入等待池,可以由本线程的 interrupt() 方法解救,使本线程可以去重新竞争锁等等.是如何实现的呢? 实际上,中断仅仅是在线程对象做一个标记而已,称为中断 ...
- [转]Linux系统结构
Linux系统一般有4个主要部分:内核.shell.文件系统.应用程序. 内核.shell和文件系统一起形成了基本的操作系统结构,它们使得用户可以运行程序.管理文件并使用系统. 1.linux内核 内 ...
- NLP(十八) 一维卷积网络IMDB情感分析
准备 Keras的IMDB数据集,包含一个词集和对应的情感标签 import pandas as pd from keras.preprocessing import sequence from ke ...
- HDU 6364 Ringland
Ringland 题意: 在一个环上有n个男生, n个女生, 现在要求每一个男生与女生配对, 求总代价最小. 题解: 如果2个男生到女生的路交叉了, 那么我们交换这2个男生的路, 总代价是一定会变得小 ...
- 牛客小白月赛6 F 发电 树状数组单点更新 求区间乘积 模板
链接:https://www.nowcoder.com/acm/contest/136/F来源:牛客网 HA实验是一个生产.提炼“神力水晶”的秘密军事基地,神力水晶可以让机器的工作效率成倍提升. ...
- lightoj 1201 - A Perfect Murder(树形dp)
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1201 题解:简单的树形dp,dp[0][i]表示以i为根结点不傻i的最多有多少 ...
- 牛客网暑期ACM多校训练营(第四场) G Maximum Mode 思维
链接:https://www.nowcoder.com/acm/contest/142/G来源:牛客网 The mode of an integer sequence is the value tha ...
- cesium页面小控件的隐藏
cesium页面小控件的隐藏 1 创建一个Viewer var viewer = new Cesium.Viewer('cesiumContainer');//cesiumContainer为di ...
- iOS组件化实践
参考资料: http://wereadteam.github.io/2016/03/19/iOS-Component/#more https://casatwy.com/iOS-Modulizatio ...
- 【Offer】[46] 【把数字翻译成字符串】
题目描述 思路分析 测试用例 Java代码 代码链接 题目描述 给定一个数字,我们按照如下规则把它翻译为字符串: 0翻译成"a",1翻译成"b",..... 1 ...