jQuery响应式LightBox插件特效代码

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

以下是 jQuery响应式LightBox插件特效代码 的示例演示效果:

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

部分效果截图:

jQuery响应式LightBox插件特效代码

HTML代码(index.html):

<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jQuery响应式LightBox插件</title>
<link rel="stylesheet" type="text/css" href="css/zzsc-demo.css">
<link rel="stylesheet" href="dist/css/chocolat.css" />
<style type="text/css">
body{
	text-align: center;
}
</style>
</head>
<body>
<div class="zzsc-container">
<h2>
	   Full window, contain, click the numbers to open:
	</h2>
	<div id="example0">
		<a class="chocolat-image" href="demo-images/5.jpg" title="HO">
			1
		</a>
		<a class="chocolat-image" href="demo-images/6.jpg" title="HAI">
			2
		</a>
		<a class="chocolat-image" href="demo-images/3.jpg" title="IO">
			3
		</a>
	</div>

	<h2>
		Full window, cover, looping :
	</h2>
	<div id="example1">
		<a class="chocolat-image" href="demo-images/1.jpg" title="foo">
			C
		</a>
		<a class="chocolat-image" href="demo-images/2.jpg" title="bar">
			D
		</a>
	</div>

	<h2>
		Display in a container, cover, with thumbnails :
	</h2>

	<div id="example3" data-chocolat-title="set title">
		<a class="chocolat-image" href="demo-images/3.jpg" title="Rose">
			<img src="demo-images/3.jpg" style="width:75px; height:50px" alt="">
		</a>
		<a class="chocolat-image" href="demo-images/4.jpg" title="Black">
			<img src="demo-images/4.jpg" style="width:75px; height:50px" alt="">
		</a>
		<a class="chocolat-image" href="demo-images/5.jpg" title="Yellow">
			<img src="demo-images/5.jpg" style="width:75px; height:50px" alt="">
		</a>
	</div>
	<!-- Container (notice the relative width) :  -->
	<div id="container2" style="width: 80%; max-width:1000px; height: 600px; background: #E0E0E0; margin:auto;"></div>

	<h2>
		Display in a container, looping :
	</h2>

	<div id="example2" data-chocolat-title="set title">
		<a class="chocolat-image" href="demo-images/3.jpg" title="Rose">
			A
		</a>
		<a class="chocolat-image" href="demo-images/4.jpg" title="Black">
			B
		</a>
		<a class="chocolat-image" href="demo-images/5.jpg" title="Yellow">
			C
		</a>
	</div>
	<!-- Container (notice the relative width) :  -->
	<div id="container1" style="width: 80%; max-width:1000px; height: 600px; background: #E0E0E0; margin:auto;"></div>


	<h2>
		API use, in container, see code source <br>
		Open console to have details abouts events
	</h2>

	<a class="api-open" href="#">Open</a> then try <br>
	<a class="api-next" href="#">Next</a>
	<a class="api-prev" href="#">Prev</a>
	<br>
	<a class="api-cover" href="#">Enter cover mode</a> /
	<a class="api-contain" href="#">Enter contain mode</a>

	<br>
	<br>
	<a class="api-close" href="#">Close</a>
	<!-- Container (notice the relative width) :  -->
	<div id="container3" style="width: 80%; max-width:1000px; height: 600px; background: #E0E0E0; margin:auto;"></div>

</div>

<script src="js/jquery-1.10.2.min.js" type="text/javascript"></script>
<script type="text/javascript" src="dist/js/jquery.chocolat.js"></script>
<script>
	$(function(){
		$('#example0').Chocolat({
			imageSize: 'contain'
		});

		$('#example1').Chocolat({
			loop           : true,
			imageSize     : 'cover',
			overlayOpacity : 0.9
		});

		$('#example2').Chocolat({
			container      : '#container1',
			imageSize     : 'contain',
			loop           : true,
		})

		$('#example3').Chocolat({
			container      : '#container2',
			imageSize     : 'cover',
		})
	});

	$(function(){
		var instance = $('#container3').Chocolat({
			setTitle : 'set title',
			loop: true,
			images : [
				{src : 'demo-images/1.jpg', title : 'caption 1'},
				{src : 'demo-images/6.jpg', title : 'caption 2'},
				{src : 'demo-images/8.jpg', title : 'caption 3'},
			],
			imageSize : 'contain',
			container : '#container3'
		}).data('chocolat');

		$('.api-open').on('click', function(e) {
			e.preventDefault()

			console.log('open start');
			var def = instance.api().open()

			def.done(function(){
				console.log('open done');
			})
		})
		$('.api-close').on('click', function(e) {
			e.preventDefault()

			console.log('close start');
			var def = instance.api().close()

			def.done(function(){
				console.log('close done');
			})
		})
		$('.api-prev').on('click', function(e) {
			e.preventDefault()

			console.log('prev start');
			var def = instance.api().prev()

			def.done(function(){
				console.log('prev done');
			})
		})
		$('.api-next').on('click', function(e) {
			e.preventDefault()

			console.log('next start');
			var def = instance.api().next()

			def.done(function(){
				console.log('next done');
			})
		})

		$('.api-cover').on('click', function(e) {
			e.preventDefault()

			console.log('cover mode start')
			instance.api().set('imageSize', 'cover')
			var def = instance.api().place()

			def.done(function(){
				console.log('cover mode done')
			})
		})

		$('.api-contain').on('click', function(e) {
			e.preventDefault()

			console.log('contain mode start')
			instance.api().set('imageSize', 'contain')
			var def = instance.api().place()

			def.done(function(){
				console.log('contain mode done')
			})
		})
	});
</script>
</body>
</html>

CSS代码(chocolat.css):

.chocolat-zoomable.chocolat-zoomed .chocolat-img{cursor:zoom-out;}
.chocolat-open{overflow:hidden;}
.chocolat-overlay{height:100%;width:100%;position:fixed;left:0;top:0;z-index:10;background-color:#fff;display:none;opacity:0.8;}
.chocolat-wrapper{height:100%;width:100%;position:fixed;left:0;top:0;z-index:16;color:#fff;}
.chocolat-zoomable .chocolat-img{cursor:zoom-in;}
.chocolat-loader{height:32px;width:32px;position:absolute;left:50%;top:50%;margin-left:-16px;margin-top:-16px;z-index:11;background:url(../images/loader.gif);display:none;}
.chocolat-content{position:fixed;width:0px;height:0px;left:50%;top:50%;z-index:14;text-align:left;}
.chocolat-content .chocolat-img{position:absolute;width:100%;height:100%;}
.chocolat-wrapper .chocolat-left{position:absolute;left:0;width:50px;height:100px;top:50%;margin-top:-50px;cursor:pointer;background:url(../images/left.png) 50% 50% no-repeat;z-index:17;display:none;}
.chocolat-wrapper .chocolat-right{position:absolute;right:0;width:50px;height:100px;top:50%;margin-top:-50px;cursor:pointer;background:url(../images/right.png) 50% 50% no-repeat;z-index:17;display:none;}
.chocolat-wrapper .chocolat-right.active{display:block;}
.chocolat-wrapper .chocolat-left.active{display:block;}
.chocolat-wrapper .chocolat-top{position:absolute;top:0px;right:0;left:0;line-height:50px;height:50px;overflow:hidden;z-index:17;margin-bottom:10px;}
.chocolat-wrapper .chocolat-close{width:50px;height:50px;cursor:pointer;position:absolute;top:0;right:0;background:url(../images/close.png) 50% 50% no-repeat;}
.chocolat-wrapper .chocolat-bottom{position:absolute;bottom:0;left:0;right:0;line-height:40px;height:40px;font-size:12px;z-index:17;padding-left:15px;padding-right:15px;background:rgba(0,0,0,0.2);text-align:right;margin-top:10px;}
.chocolat-wrapper .chocolat-set-title{display:inline-block;padding-right:15px;line-height:1;border-right:1px solid rgba(255,255,255,0.3);}
.chocolat-wrapper .chocolat-pagination{float:right;display:inline-block;padding-left:15px;padding-right:15px;margin-right:15px;/*border-right:1px solid rgba(255,255,255,0.2);*/
}
.chocolat-wrapper .chocolat-fullscreen{width:16px;height:40px;background:url(../images/fullscreen.png) 50% 50% no-repeat;display:block;margin:auto;cursor:pointer;float:right;}
.chocolat-wrapper .chocolat-description{display:inline-block;float:left;}
/* no container mode*/
body.chocolat-open>.chocolat-overlay{z-index:15;}
body.chocolat-open>.chocolat-loader{z-index:15;}
body.chocolat-open>.chocolat-content{z-index:17;}
/* container mode*/
.chocolat-in-container .chocolat-wrapper,.chocolat-in-container .chocolat-content,.chocolat-in-container .chocolat-overlay{position:absolute;}
.chocolat-in-container{position:relative;}
/* uncomment to hide controls when zoomed-in*/
/*.chocolat-zoomable .chocolat-top,.chocolat-zoomable .chocolat-bottom,.chocolat-zoomable .chocolat-right,.chocolat-zoomable .chocolat-left{transition:opacity .3s ease,visibility 0s .3s;opacity:1;}
.chocolat-zoomable.chocolat-zoomed .chocolat-top,.chocolat-zoomable.chocolat-zoomed .chocolat-bottom,.chocolat-zoomable.chocolat-zoomed .chocolat-right,.chocolat-zoomable.chocolat-zoomed .chocolat-left{visibility:hidden;opacity:0;}
*/

CSS代码(zzsc-demo.css):

@import url(http://fonts.useso.com/css?family=Raleway:200,500,700,800);@font-face{font-family:'icomoon';src:url('../fonts/icomoon.eot?rretjt');src:url('../fonts/icomoon.eot?#iefixrretjt') format('embedded-opentype'),url('../fonts/icomoon.woff?rretjt') format('woff'),url('../fonts/icomoon.ttf?rretjt') format('truetype'),url('../fonts/icomoon.svg?rretjt#icomoon') format('svg');font-weight:normal;font-style:normal;}
[class^="icon-"],[class*=" icon-"]{font-family:'icomoon';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;/* Better Font Rendering =========== */
-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;}
body,html{font-size:100%;padding:0;margin:0;}
/* Reset */
*,*:after,*:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}
/* Clearfix hack by Nicolas Gallagher:http://nicolasgallagher.com/micro-clearfix-hack/ */
.clearfix:before,.clearfix:after{content:" ";display:table;}
.clearfix:after{clear:both;}
body{background:#494A5F;color:#D5D6E2;font-weight:500;font-size:1.05em;font-family:"Microsoft YaHei","宋体","Segoe UI","Lucida Grande",Helvetica,Arial,sans-serif,FreeSans,Arimo;}
a{color:#2fa0ec;text-decoration:none;outline:none;}
a:hover,a:focus{color:#74777b;}
.zzsc-container{margin:0 auto;overflow:hidden;}
.bgcolor-1{background:#f0efee;}
.bgcolor-2{background:#f9f9f9;}
.bgcolor-3{background:#e8e8e8;}
/*light grey*/
.bgcolor-4{background:#2f3238;color:#fff;}
/*Dark grey*/
.bgcolor-5{background:#df6659;color:#521e18;}
/*pink1*/
.bgcolor-6{background:#2fa8ec;}
/*sky blue*/
.bgcolor-7{background:#d0d6d6;}
/*White tea*/
.bgcolor-8{background:#3d4444;color:#fff;}
/*Dark grey2*/
.bgcolor-9{background:#ef3f52;color:#fff;}
/*pink2*/
.bgcolor-10{background:#64448f;color:#fff;}
/*Violet*/
.bgcolor-11{background:#3755ad;color:#fff;}
/*dark blue*/
.bgcolor-12{background:#3498DB;color:#fff;}
/*light blue*/
.bgcolor-20{background:#494A5F;color:#D5D6E2;}
/* Header */
.zzsc-header{padding:1em 190px 1em;letter-spacing:-1px;text-align:center;background:#66677c;}
.zzsc-header h1{color:#D5D6E2;font-weight:600;font-size:2em;line-height:1;margin-bottom:0;font-family:"Microsoft YaHei","宋体","Segoe UI","Lucida Grande",Helvetica,Arial,sans-serif,FreeSans,Arimo;}
.zzsc-header h1 span{font-family:"Microsoft YaHei","宋体","Segoe UI","Lucida Grande",Helvetica,Arial,sans-serif,FreeSans,Arimo;display:block;font-size:60%;font-weight:400;padding:0.8em 0 0.5em 0;color:#c3c8cd;}
/*nav*/
.zzsc-demo a{color:#fff;text-decoration:none;}
.zzsc-demo{width:100%;padding-bottom:1.2em;}
.zzsc-demo a{display:inline-block;margin:0.5em;padding:0.6em 1em;border:3px solid #fff;font-weight:700;}
.zzsc-demo a:hover{opacity:0.6;}
.zzsc-demo a.current{background:#1d7db1;color:#fff;}
/* Top Navigation Style */
.zzsc-links{position:relative;display:inline-block;white-space:nowrap;font-size:1.5em;text-align:center;}
.zzsc-links::after{position:absolute;top:0;left:50%;margin-left:-1px;width:2px;height:100%;background:#dbdbdb;content:'';-webkit-transform:rotate3d(0,0,1,22.5deg);transform:rotate3d(0,0,1,22.5deg);}
.zzsc-icon{display:inline-block;margin:0.5em;padding:0em 0;width:1.5em;text-decoration:none;}
.zzsc-icon span{display:none;}
.zzsc-icon:before{margin:0 5px;text-transform:none;font-weight:normal;font-style:normal;font-variant:normal;font-family:'icomoon';line-height:1;speak:none;-webkit-font-smoothing:antialiased;}
/* footer */
.zzsc-footer{width:100%;padding-top:10px;}
.zzsc-small{font-size:0.8em;}
.center{text-align:center;}
/****/
.related{color:#fff;background:#494A5F;text-align:center;font-size:1.25em;padding:0.5em 0;overflow:hidden;}
.related > a{vertical-align:top;width:calc(100% - 20px);max-width:340px;display:inline-block;text-align:center;margin:20px 10px;padding:25px;font-family:"Microsoft YaHei","宋体","Segoe UI","Lucida Grande",Helvetica,Arial,sans-serif,FreeSans,Arimo;}
.related a{display:inline-block;text-align:left;margin:20px auto;padding:10px 20px;opacity:0.8;-webkit-transition:opacity 0.3s;transition:opacity 0.3s;-webkit-backface-visibility:hidden;}
.related a:hover,.related a:active{opacity:1;}
.related a img{max-width:100%;opacity:0.8;border-radius:4px;}
.related a:hover img,.related a:active img{opacity:1;}
.related h3{font-family:"Microsoft YaHei",sans-serif;}
.related a h3{font-weight:300;margin-top:0.15em;color:#fff;}
/* icomoon */
.icon-zzsc-home-outline:before{content:"\e5000";}
.icon-zzsc-arrow-forward-outline:before{content:"\e5001";}
@media screen and (max-width:50em){.zzsc-header{padding:3em 10% 4em;}
.zzsc-header h1{font-size:2em;}
}
@media screen and (max-width:40em){.zzsc-header h1{font-size:1.5em;}
}
@media screen and (max-width:30em){.zzsc-header h1{font-size:1.2em;}
}
附件:下载该文件资源,减少时间成本(增值服务)
留言
该资源可下载
File Source
.rar
661.45 KB
Html Js 图片切换触摸3
最新结算
股权转让协议意向书模板
类型: .docx 金额: CNY 2.23¥ 状态: 待结算 详细>
股权转让协议意向书模板
类型: .docx 金额: CNY 0.28¥ 状态: 待结算 详细>
CSS3图片向上3D翻转渐隐消失特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
CSS3图片向上3D翻转渐隐消失特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
.net c# 将金额转人名币大写金额
类型: .rar 金额: CNY 2.39¥ 状态: 待结算 详细>
.net c# 将金额转人名币大写金额
类型: .rar 金额: CNY 0.3¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 2.23¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 0.28¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 2.23¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 0.28¥ 状态: 待结算 详细>
我们力求给您提供有用的文章,再此基础上,会附加营收资源,不做任何广告,让平台可以更好发展 若您发现您的权利被侵害,或使用了您的版权,请发邮件联系 sunlifel@foxmail.com ggbig觉得 : 不提供源码的文章不是好文章
合作伙伴
联系我们
  • QQ:21499807
  • 邮箱:sunlifel@foxmail.com
  • QQ扫一扫加QQ
    QQ扫一扫
Copyright 2023-2024 ggbig.com·皖ICP备2023004211号-1
打赏文章