jQuery图片特效插件Revealing实现拉伸放大
更新时间:2015年04月22日 12:29:32 投稿:hebedich
本文给大家分享的是jQuery图片展示效果,使用的是jQuery Revealing插件,不点击的情况下,图片整齐排列成一行,当任意一个图片缩略图被点击的时候,该图片就放大显示,当点击关闭按钮时图片又重新还原了缩略图模式。
点击图片,图片拉伸放大显示,效果非常棒!
使用方法:
1、head区域引用文件 jquery.js,photorevealer.js,datouwang.css
2、在文件中加入<!-- 代码 开始 --><!-- 代码 结束 -->区域代码
3、图片个数可以自由增减,增加或者删除<td></td>即可
4、如果图片信息更多,需要更大的空间,可修改photorevealer.js中第36行的数字
核心代码:
$(document).ready(function(){
$('.photo_slider').each(function(){
var $this = $(this).addClass('photo-area');
var $img = $this.find('img');
var $info = $this.find('.info_area');
var opts = {};
$img.load(function(){
opts.imgw = $img.width();
opts.imgh = $img.height();
});
opts.orgw = $this.width();
opts.orgh = $this.height();
$img.css ({
marginLeft: "-150px",
marginTop: "-150px"
});
var $wrap = $('<div class="photo_slider_img">').append($img).prependTo($this);
var $open = $('<a href="#" class="more_info">More Info ></a>').appendTo($this);
var $close = $('<a class="close">Close</a>').appendTo($info);
opts.wrapw = $wrap.width();
opts.wraph = $wrap.height();
$open.click(function(){
$this.animate({
width: opts.imgw,
height: (opts.imgh+30),
borderWidth: "10"
}, 600 );
$open.fadeOut();
$wrap.animate({
width: opts.imgw,
height: opts.imgh
}, 600 );
$(".info_area",$this).fadeIn();
$img.animate({
marginTop: "0px",
marginLeft: "0px"
}, 600 );
return false;
});
$close.click(function(){
$this.animate({
width: opts.orgw,
height: opts.orgh,
borderWidth: "1"
}, 600 );
$open.fadeIn();
$wrap.animate({
width: opts.wrapw,
height: opts.wraph
}, 600 );
$img.animate({
marginTop: "-150px",
marginLeft: "-150px"
}, 600 );
$(".info_area",$this).fadeOut();
return false;
});
});
});
以上所述就是本文的全部代码了,希望大家能够喜欢。
相关文章
jQuery.extend 与 jQuery.fn.extend的用法及区别实例分析
这篇文章主要介绍了jQuery.extend 与 jQuery.fn.extend的用法及区别,结合实例形式分析了jQuery.extend与jQuery.fn.extend的功能、使用方法及区别,需要的朋友可以参考下2018-07-07
jQuery中绑定事件bind() on() live() one()的异同
本文主要介绍了jQuery中绑定事件bind() on() live() one()的异同,具有很好的参考价值,下面跟着小编一起来看下吧2017-02-02
浅谈jquery fullpage 插件增加头部和版权的方法
下面小编就为大家分享一篇浅谈jquery fullpage 插件增加头部和版权的方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看2018-03-03


最新评论