jQuery圖片特效插件Revealing實現(xiàn)拉伸放大
更新時間:2015年04月22日 12:29:32 投稿:hebedich
本文給大家分享的是jQuery圖片展示效果,使用的是jQuery Revealing插件,不點擊的情況下,圖片整齊排列成一行,當任意一個圖片縮略圖被點擊的時候,該圖片就放大顯示,當點擊關閉按鈕時圖片又重新還原了縮略圖模式。
點擊圖片,圖片拉伸放大顯示,效果非常棒!
使用方法:
1、head區(qū)域引用文件 jquery.js,photorevealer.js,datouwang.css
2、在文件中加入<!-- 代碼 開始 --><!-- 代碼 結束 -->區(qū)域代碼
3、圖片個數(shù)可以自由增減,增加或者刪除<td></td>即可
4、如果圖片信息更多,需要更大的空間,可修改photorevealer.js中第36行的數(shù)字
核心代碼:
$(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的用法及區(qū)別實例分析
這篇文章主要介紹了jQuery.extend 與 jQuery.fn.extend的用法及區(qū)別,結合實例形式分析了jQuery.extend與jQuery.fn.extend的功能、使用方法及區(qū)別,需要的朋友可以參考下2018-07-07
jQuery中綁定事件bind() on() live() one()的異同
本文主要介紹了jQuery中綁定事件bind() on() live() one()的異同,具有很好的參考價值,下面跟著小編一起來看下吧2017-02-02
jQuery實現(xiàn)感應鼠標動畫效果自動伸長的輸入框實例
這篇文章主要介紹了jQuery實現(xiàn)感應鼠標動畫效果自動伸長的輸入框,實例分析了jQuery鼠標事件及animate動畫效果的使用技巧,具有一定參考借鑒價值,需要的朋友可以參考下2015-02-02
淺談jquery fullpage 插件增加頭部和版權的方法
下面小編就為大家分享一篇淺談jquery fullpage 插件增加頭部和版權的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看2018-03-03

