jquery全屏缩略图翻转特效代码

版权:原创 更新时间:1年以上
[该文章底部包含文件资源,可根据自己情况,决定是否下载资源使用,时间>金钱,如有需要,立即查看资源]

以下是 jquery全屏缩略图翻转特效代码 的示例演示效果:

当前平台(PC电脑)
  • 平台:

部分效果截图:

jquery全屏缩略图翻转特效代码

HTML代码(index.html):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <title>jquery全屏缩略图翻转</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="css/style.css" />
		<link href='http://fonts.googleapis.com/css?family=PT+Sans+Narrow' rel='stylesheet' type='text/css' />
		<link href='http://fonts.googleapis.com/css?family=Dancing+Script' rel='stylesheet' type='text/css' />
    </head>
    <body>
		<div id="tf_loading" class="tf_loading"></div>
		<div id="tf_bg" class="tf_bg">
			<img src="images/1.jpg" alt="Image 1" longdesc="images/thumbs/1.jpg" />
			<img src="images/2.jpg" alt="Image 2" longdesc="images/thumbs/2.jpg"/>
			<img src="images/3.jpg" alt="Image 3" longdesc="images/thumbs/3.jpg"/>
			<img src="images/4.jpg" alt="Image 4" longdesc="images/thumbs/4.jpg"/>
			<img src="images/5.jpg" alt="Image 5" longdesc="images/thumbs/5.jpg"/>
			<img src="images/6.jpg" alt="Image 6" longdesc="images/thumbs/6.jpg"/>
			<div class="tf_pattern"></div>
		</div>
		<div id="tf_content_wrapper" class="tf_content_wrapper">
			<div class="tf_content" id="content1" style="display:block;">
				<h2>Dreamer</h2>
				<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p>
			</div>
			<div class="tf_content" id="content2">
				<h2>Crusader</h2>
				<p>Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia.</p>
			</div>
			<div class="tf_content" id="content3">
				<h2>Adventurer</h2>
				<p>It is a paradisematic country, in which roasted parts of sentences fly into your mouth.</p>
			</div>
			<div class="tf_content" id="content4">
				<h2>Risk Taker</h2>
				<p>She packed her seven versalia, put her initial into the belt and made herself on the way.</p>
			</div>
			<div class="tf_content" id="content5">
				<h2>Visioneer</h2>
				<p>Pityful a rethoric question ran over her cheek, then she continued her way. On her way she met a copy.</p>
			</div>
			<div class="tf_content" id="content6">
				<h2>Magician</h2>
				<p>And if she hasn’t been rewritten, then they are still using her. Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p>
			</div>
		</div>

		<div id="tf_thumbs" class="tf_thumbs">
			<span id="tf_zoom" class="tf_zoom"></span>
			<img src="images/thumbs/1.jpg" alt="Thumb1"/>
		</div>

		<div id="tf_next" class="tf_next"></div>
		<div id="tf_prev" class="tf_prev"></div>
		<div class="description">
			<span>Use keys &uarr; and &darr; or the wheel of the mouse to navigate.</span>
		</div>
		<!-- The JavaScript -->
		<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
		<script type="text/javascript" src="js/jquery-ui.min.js"></script>
		<script type="text/javascript" src="js/jquery.flip.js"></script>
		<script type="text/javascript" src="js/jquery-mousewheel-3.0.4/jquery.mousewheel.min.js"></script>
        <script type="text/javascript">
			/*
			the images preload plugin
			*/
			(function($) {
				$.fn.preload = function(options) {
					var opts 	= $.extend({}, $.fn.preload.defaults, options);
					o			= $.meta ? $.extend({}, opts, this.data()) : opts;
					var c		= this.length,
						l		= 0;
					return this.each(function() {
						var $i	= $(this);
						$('<img/>').load(function(i){
							++l;
							if(l == c) o.onComplete();
						}).attr('src',$i.attr('src'));	
					});
				};
				$.fn.preload.defaults = {
					onComplete	: function(){return false;}
				};
			})(jQuery);
		</script>
		<script type="text/javascript">
			$(function() {
				var $tf_bg				= $('#tf_bg'),
					$tf_bg_images		= $tf_bg.find('img'),
					$tf_bg_img			= $tf_bg_images.eq(0),
					$tf_thumbs			= $('#tf_thumbs'),
					total				= $tf_bg_images.length,
					current				= 0,
					$tf_content_wrapper	= $('#tf_content_wrapper'),
					$tf_next			= $('#tf_next'),
					$tf_prev			= $('#tf_prev'),
					$tf_loading			= $('#tf_loading');
				
				//preload the images				
				$tf_bg_images.preload({
					onComplete	: function(){
						$tf_loading.hide();
						init();
					}
				});
				
				//shows the first image and initializes events
				function init(){
					//get dimentions for the image, based on the windows size
					var dim	= getImageDim($tf_bg_img);
					//set the returned values and show the image
					$tf_bg_img.css({
						width	: dim.width,
						height	: dim.height,
						left	: dim.left,
						top		: dim.top
					}).fadeIn();
				
					//resizing the window resizes the $tf_bg_img
				$(window).bind('resize',function(){
					var dim	= getImageDim($tf_bg_img);
					$tf_bg_img.css({
						width	: dim.width,
						height	: dim.height,
						left	: dim.left,
						top		: dim.top
					});
				});
				
					//expand and fit the image to the screen
					$('#tf_zoom').live('click',
						function(){
						if($tf_bg_img.is(':animated'))
							return false;
				
							var $this	= $(this);
							if($this.hasClass('tf_zoom')){
								resize($tf_bg_img);
								$this.addClass('tf_fullscreen')
									 .removeClass('tf_zoom');
							}
							else{
								var dim	= getImageDim($tf_bg_img);
								$tf_bg_img.animate({
									width	: dim.width,
									height	: dim.height,
									top		: dim.top,
									left	: dim.left
								},350);
								$this.addClass('tf_zoom')
									 .removeClass('tf_fullscreen');	
							}
						}
					);
					
					//click the arrow down, scrolls down
					$tf_next.bind('click',function(){
						if($tf_bg_img.is(':animated'))
							return false;
							scroll('tb');
					});
					
					//click the arrow up, scrolls up
					$tf_prev.bind('click',function(){
						if($tf_bg_img.is(':animated'))
						return false;
						scroll('bt');
					});
					
					//mousewheel events - down / up button trigger the scroll down / up
					$(document).mousewheel(function(e, delta) {
						if($tf_bg_img.is(':animated'))
							return false;
							
						if(delta > 0)
							scroll('bt');
						else
							scroll('tb');
						return false;
					});
					
					//key events - down / up button trigger the scroll down / up
					$(document).keydown(function(e){
						if($tf_bg_img.is(':animated'))
							return false;
						
						switch(e.which){
							case 38:	
								scroll('bt');
								break;	

							case 40:	
								scroll('tb');
								break;
						}
					});
				}
				
				//show next / prev image
				function scroll(dir){
					//if dir is "tb" (top -> bottom) increment current, 
					//else if "bt" decrement it
					current	= (dir == 'tb')?current + 1:current - 1;
					
					//we want a circular slideshow, 
					//so we need to check the limits of current
					if(current == total) current = 0;
					else if(current < 0) current = total - 1;
					
					//flip the thumb
					$tf_thumbs.flip({
						direction	: dir,
						speed		: 400,
						onBefore	: function(){
							//the new thumb is set here
							var content	= '<span id="tf_zoom" class="tf_zoom"></span>';
							content		+='<img src="' + $tf_bg_images.eq(current).attr('longdesc') + '" alt="Thumb' + (current+1) + '"/>';
							$tf_thumbs.html(content);
					}
					});

					//we get the next image
					var $tf_bg_img_next	= $tf_bg_images.eq(current),
						//its dimentions
						dim				= getImageDim($tf_bg_img_next),
						//the top should be one that makes the image out of the viewport
						//the image should be positioned up or down depending on the direction
							top	= (dir == 'tb')?$(window).height() + 'px':-parseFloat(dim.height,10) + 'px';
							
					//set the returned values and show the next image	
						$tf_bg_img_next.css({
							width	: dim.width,
							height	: dim.height,
							left	: dim.left,
							top		: top
						}).show();
						
					//now slide it to the viewport
						$tf_bg_img_next.stop().animate({
							top 	: dim.top
						},1000);
						
					//we want the old image to slide in the same direction, out of the viewport
						var slideTo	= (dir == 'tb')?-$tf_bg_img.height() + 'px':$(window).height() + 'px';
						$tf_bg_img.stop().animate({
							top 	: slideTo
						},1000,function(){
						//hide it
							$(this).hide();
						//the $tf_bg_img is now the shown image
							$tf_bg_img	= $tf_bg_img_next;
						//show the description for the new image
							$tf_content_wrapper.children()
											   .eq(current)
										       .show();
				});
					//hide the current description	
						$tf_content_wrapper.children(':visible')
										   .hide()
				
				}
				
				//animate the image to fit in the viewport
				function resize($img){
					var w_w	= $(window).width(),
						w_h	= $(window).height(),
						i_w	= $img.width(),
						i_h	= $img.height(),
						r_i	= i_h / i_w,
						new_w,new_h;
					
					if(i_w > i_h){
						new_w	= w_w;
						new_h	= w_w * r_i;
						
						if(new_h > w_h){
							new_h	= w_h;
							new_w	= w_h / r_i;
						}
					}	
					else{
						new_h	= w_w * r_i;
						new_w	= w_w;
					}
					
					$img.animate({
						width	: new_w + 'px',
						height	: new_h + 'px',
						top		: '0px',
						left	: '0px'
					},350);
				}
				
				//get dimentions of the image, 
				//in order to make it full size and centered
				function getImageDim($img){
					var w_w	= $(window).width(),
						w_h	= $(window).height(),
						r_w	= w_h / w_w,
						i_w	= $img.width(),
						i_h	= $img.height(),
						r_i	= i_h / i_w,
						new_w,new_h,
						new_left,new_top;
					
					if(r_w > r_i){
						new_h	= w_h;
						new_w	= w_h / r_i;
					}
					else{
						new_h	= w_w * r_i;
						new_w	= w_w;
					}


					return {
						width	: new_w + 'px',
						height	: new_h + 'px',
						left	: (w_w - new_w) / 2 + 'px',
						top		: (w_h - new_h) / 2 + 'px'
					};
					}
			});
        </script>
    </body>
</html>





JS代码(jquery.flip.min.js):

eval(function(p,a,c,k,e,r){
	e=function(c){
	return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))}
;
	if(!''.replace(/^/,String)){
	while(c--)r[e(c)]=k[c]||e(c);
	k=[function(e){
	return r[e]}
];
	e=function(){
	return'\\w+'}
;
	c=1}
;
	while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);
	return p}
('(5($){
	5 L(a){
	a.3x.1F[a.3r]=3o(a.3n,10)+a.3l}
6 j=5(a){
	3k({
	3i:"1E.1d.3d 3c 3b",38:a}
)}
;
	6 k=5(){
	7(/*@2S!@*/
19&&(2Q 2N.1w.1F.2K==="2F"))}
;
	6 l={
	2C:[0,4,4],2B:[1u,4,4],2y:[1s,1s,2v],2u:[0,0,0],2t:[0,0,4],2s:[1q,1p,1p],2o:[0,4,4],2n:[0,0,B],2m:[0,B,B],2l:[1b,1b,1b],2j:[0,1c,0],2i:[2h,2g,1o],2e:[B,0,B],2d:[2c,1o,2b],2a:[4,1n,0],27:[24,21,20],1Z:[B,0,0],1Y:[1R,1P,1O],1N:[3s,0,Y],2f:[4,0,4],1Q:[4,2z,0],2E:[0,t,0],22:[26,0,28],29:[1u,1z,1n],2p:[2r,2w,1z],2x:[1h,4,4],2A:[1i,2G,1i],2L:[Y,Y,Y],2M:[4,2O,2W],33:[4,4,1h],34:[0,4,0],35:[4,0,4],36:[t,0,0],39:[0,0,t],3e:[t,t,0],3j:[4,1q,0],3m:[4,W,3t],1H:[t,0,t],1I:[t,0,t],1J:[4,0,0],1K:[W,W,W],1L:[4,4,4],1M:[4,4,0],9:[4,4,4]}
;
	6 m=5(a){
	U(a&&a.1j("#")==-1&&a.1j("(")==-1){
	7"1S("+l[a].1T()+")"}
1U{
	7 a}
}
;
	$.1V($.1W.1X,{
	w:L,x:L,u:L,v:L}
);
	$.1k.23=5(){
	7 V.1l(5(){
	6 a=$(V);
	a.1d(a.F(\'1m\'))}
)}
;
	$.1k.1d=5(i){
	7 V.1l(5(){
	6 c=$(V),3,$8,C,11,1f,1e=k();
	U(c.F(\'S\')){
	7 19}
6 e={
	R:(5(a){
	2k(a){
	X"T":7"Z";
	X"Z":7"T";
	X"15":7"14";
	X"14":7"15";
	2q:7"Z"}
}
)(i.R),y:m(i.A)||"#H",A:m(i.y)||c.z("12-A"),1r:c.N(),D:i.D||1t,Q:i.Q||5(){
}
,K:i.K||5(){
}
,P:i.P||5(){
}
}
;
	c.F(\'1m\',e).F(\'S\',1).F(\'2D\',e);
	3={
	s:c.s(),p:c.p(),y:m(i.y)||c.z("12-A"),1v:c.z("2H-2I")||"2J",R:i.R||"T",E:m(i.A)||"#H",D:i.D||1t,o:c.1x().o,n:c.1x().n,1y:i.1r||2P,9:"9",18:i.18||19,Q:i.Q||5(){
}
,K:i.K||5(){
}
,P:i.P||5(){
}
}
;
	1e&&(3.9="#2R");
	$8=c.z("16","2T").8(2U).F(\'S\',1).2V("1w").N("").z({
	16:"1g",2X:"2Y",n:3.n,o:3.o,2Z:0,30:31,"-32-1A-1B":"G G G #1C","-37-1A-1B":"G G G #1C"}
);
	6 f=5(){
	7{
	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}
)(3w);
	',62,220,'|||flipObj|255|function|var|return|clone|transparent||||||||||||||left|top|height|start|second|width|128|borderLeftWidth|borderRightWidth|borderTopWidth|borderBottomWidth|bgColor|css|color|139|dirOption|speed|toColor|data|0px|999|borderLeftColor|borderRightColor|onEnd|int_prop|borderTopColor|html|borderBottomColor|onAnimation|onBefore|direction|flipLock|tb|if|this|192|case|211|bt||dirOptions|background|dequeue|rl|lr|visibility|queue|dontChangeColor|false|first|169|100|flip|ie6|newContent|visible|224|144|indexOf|fn|each|flipRevertedSettings|140|107|42|165|content|245|500|240|fontSize|body|offset|target|230|box|shadow|000|backgroundColor|jquery|style|animate|purple|violet|red|silver|white|yellow|darkviolet|122|150|gold|233|rgb|toString|else|extend|fx|step|darksalmon|darkred|204|50|indigo|revertFlip|153||75|darkorchid|130|khaki|darkorange|47|85|darkolivegreen|darkmagenta|fuchsia|183|189|darkkhaki|darkgreen|switch|darkgrey|darkcyan|darkblue|cyan|lightblue|default|173|brown|blue|black|220|216|lightcyan|beige|215|lightgreen|azure|aqua|flipSettings|green|undefined|238|font|size|12px|maxHeight|lightgrey|lightpink|document|182|null|typeof|123456|cc_on|hidden|true|appendTo|193|position|absolute|margin|zIndex|9999|webkit|lightyellow|lime|magenta|maroon|moz|message|navy|lineHeight|error|plugin|js|olive|none|borderStyle|solid|name|orange|throw|unit|pink|now|parseInt|filter|chroma|prop|148|203|remove|removeData|jQuery|elem'.split('|'),0,{
}
))

CSS代码(style.css):

html,body{margin:0;padding:0;}
body{background:#000;}
.tf_bg{width:100%;height:100%;position:fixed;top:0px;left:0px;}
.tf_bg img{position:absolute;top:0px;/*-482px;-(imgh/2 - wh/2) */
left:0px;/* calculate a negative value to center horizontally */
width:100%;/* windowwidth plus negative value of left */
/*height:1650px;/* windowheight plus negative value of top */
z-index:1;display:none;}
.tf_pattern{position:absolute;width:100%;height:100%;background:transparent url(../images/pattern.png) repeat top left;z-index:2;}
.tf_content{position:absolute;bottom:50px;left:50px;z-index:10;display:none;}
.tf_content h2{color:#fff;font-size:90px;padding:0;margin:0;font-family:'Dancing Script',arial,serif;text-shadow:1px 1px 2px #000;}
.tf_content p{color:#fff;padding:0;margin:0;background:transparent url(../images/bg_content.png) repeat top left;padding:40px;width:500px;font-family:'PT Sans Narrow',arial,serif;font-size:20px;line-height:25px;text-transform:uppercase;text-shadow:2px 2px 1px #000;-moz-box-shadow:1px 1px 5px #202020;-webkit-box-shadow:1px 1px 5px #202020;box-shadow:1px 1px 5px #202020;border:4px solid #fff;}
.tf_thumbs{position:absolute;z-index:12;right:50px;top:50%;margin-top:-79px;border:4px solid #fff;-moz-box-shadow:1px 1px 5px #202020;-webkit-box-shadow:1px 1px 5px #202020;box-shadow:1px 1px 5px #202020;-webkit-box-reflect:below 5px-webkit-gradient(linear,left top,left bottom,from(transparent),color-stop(0.6,transparent),to(rgb(18,18,18)));}
.tf_thumbs img{display:block;}
.tf_loading{position:fixed;top:50%;left:50%;margin:-30px 0px 0px -30px;width:60px;height:60px;background:#fff url(../images/loader.gif) no-repeat center center;z-index:999;opacity:0.7;}
.tf_next,.tf_prev{width:35px;height:14px;position:absolute;top:50%;right:320px;z-index:100;cursor:pointer;background:transparent url(../images/nav.png) no-repeat top left;opacity:0.5;}
.tf_next{background-position:0px -14px;margin-top:80px;}
.tf_prev{background-position:0px 0px;margin-top:-55px;}
.tf_next:hover,.tf_prev:hover{opacity:0.9;}
.tf_zoom,.tf_fullscreen{width:20px;height:20px;position:absolute;top:6px;right:6px;cursor:pointer;z-index:100;opacity:0.6;background:transparent url(../images/icons.png) no-repeat top left;}
.tf_zoom{background-position:0px -20px;}
.tf_fullscreen{background-position:0px 0px;}
.tf_zoom:hover,.tf_fullscreen:hover{opacity:0.9;}
.reference{position:fixed;bottom:0px;right:0px;background:#000;height:23px;text-align:right;width:100%;text-shadow:1px 1px 1px #000;z-index:999;opacity:0.8;}
.description{position:fixed;top:5px;right:5px;text-shadow:1px 1px 1px #000;z-index:999;}
.reference a,.description span{color:#fff;text-transform:uppercase;margin-left:20px;text-decoration:none;font-family:Arial;font-size:10px;}
a.last{float:left;line-height:23px;}
.reference a:hover{text-shadow:0px 0px 1px #fff;}
附件:下载该文件资源,减少时间成本(增值服务)
留言
该资源可下载
File Source
.rar
708.82 KB
Html JS 图片特效4
最新结算
jquery虚拟键盘中文打字效果js代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
jquery虚拟键盘中文打字效果js代码
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
HTML5实现CSS滤镜图片切换特效代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
jQuery头像裁剪插件cropbox js代码
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
jQuery头像裁剪插件cropbox js代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
jQuery+css3实现信封效果
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
我们力求给您提供有用的文章,再此基础上,会附加营收资源,不做任何广告,让平台可以更好发展 若您发现您的权利被侵害,或使用了您的版权,请发邮件联系 sunlifel@foxmail.com ggbig觉得 : 不提供源码的文章不是好文章
合作伙伴
联系我们
  • QQ:21499807
  • 邮箱:sunlifel@foxmail.com
  • QQ扫一扫加QQ
    QQ扫一扫
Copyright 2023-2024 ggbig.com·皖ICP备2023004211号-1
打赏文章