jQuery仿QQ空间ピクチャー查看特效(全屏、拡大、缩小、回転、ミラー、マウスホイールズーム)
ダウンロード先:http://download.csdn.net/detail/cometwo/9415928
モバイル端末をサポートするヘビー級プラグインもありますhttp://www.sucaijiayuan.com/api/demo.php?url=/demo/20140807-1
サーバーに置いてみてください.そうしないと、直接開いて閉じられません.アドレスをダウンロードします.http://download.csdn.net/detail/cometwo/9401563
軽量級のピクチャーはプラグインを見て、原文の住所http://www.cnblogs.com/huanlei/p/3607038.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="dist/viewer.min.css" />
<script type="text/javascript" src="assets/js/jquery.min.js"></script>
<script type="text/javascript" src="dist/viewer.min.js"></script>
<script type="text/javascript" src="assets/js/main.js"></script>
<style type="text/css"> #test { padding: 5px; border: 1px solid green; height: 326px; } #test .docs-pictures { margin: 0; padding: 0; list-style: none; display: block; } #test .docs-pictures li { float: left; /*width: 33.3%; height: 33.3%;*/ margin: 0 -1px -1px 0; border: 1px solid red; overflow: hidden; } #test .docs-pictures li img { width: 316px; } #imgs { width: 800px; height: 326px; border: 1px solid blue; position: relative; margin: -1px 0px -1px 0; /*boder */ } #imgs img { position: relative; width: 316px; display: block; float: left; border: 1px solid black; } </style>
</head>
<body>
<div id="imgs">
<img data-original="assets/img/emma-watson-3.jpg" src="assets/img/emma-watson-3.jpg" />
<img data-original="assets/img/emma-watson-4.jpg" src="assets/img/emma-watson-4.jpg" />
</div>
<div id="test">
<ul class="docs-pictures">
<li><img src="assets/img/emma-watson-3.jpg" /></li>
<li><img data-original="assets/img/emma-watson-1.jpg" src="assets/img/thumbnails/emma-watson-1.jpg"></li>
<li><img data-original="assets/img/emma-watson-2.jpg" src="assets/img/thumbnails/emma-watson-2.jpg"></li>
<li><img data-original="assets/img/emma-watson-3.jpg" src="assets/img/thumbnails/emma-watson-3.jpg"></li>
<li><img data-original="assets/img/emma-watson-4.jpg" src="assets/img/thumbnails/emma-watson-4.jpg"></li>
</ul>
</div>
<div id="imgs">
<img data-original="assets/img/emma-watson-3.jpg" src="assets/img/emma-watson-3.jpg" />
<img data-original="assets/img/emma-watson-4.jpg" src="assets/img/emma-watson-4.jpg" />
</div>
</body>
</html>
モバイル端末をサポートするヘビー級プラグインもありますhttp://www.sucaijiayuan.com/api/demo.php?url=/demo/20140807-1
サーバーに置いてみてください.そうしないと、直接開いて閉じられません.アドレスをダウンロードします.http://download.csdn.net/detail/cometwo/9401563
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> B QQ </title>
<script src="jquery-photo-gallery/jquery.js"></script>
<script src="jquery-photo-gallery/jquery.photo.gallery.js"></script>
</head>
<style> html,body{ width : 100%; height : 100%; margin:0; overflow: hidden; } img{ max-width: 300px; max-height: 200px; } </style>
<body>
<h2> </h2>
<div class="gallerys">
<img class="gallery-pic" src="img/1.jpg" onclick="$.openPhotoGallery(this)" />
<img class="gallery-pic" src="img/2.jpg" onclick="$.openPhotoGallery(this)" />
<img class="gallery-pic" src="img/3.jpg" onclick="$.openPhotoGallery(this)" />
<img class="gallery-pic" src="img/4.jpg" onclick="$.openPhotoGallery(this)" />
</div>
</body>
</html>
軽量級のピクチャーはプラグインを見て、原文の住所http://www.cnblogs.com/huanlei/p/3607038.html
<!doctype html>
<html lang="en">
<head>
<meta charset="gbk">
<title> </title>
<style> /* * jquery gallery CSS * ZhaoHuanLei - 20140418 */ .gallery-overlay {width:100%;height:100%;position:fixed;_top:absolute;top:0;left:0;z-index:99;filter:progid:DXImageTransform.Microsoft.gradient(enabled='true',startColorstr='#B2000000', endColorstr='#B2000000');background-color:rgba(0,0,0,.7);} :root .gallery-overlay {filter:none;} .gallery-close, .gallery-prev, .gallery-next {position:absolute;color:#fff;text-decoration:none;} .gallery-prev, .gallery-next {top:40%;font:bold 80px/80px simsun;} .gallery-prev {left:50px;} .gallery-next {right:50px;} .gallery-close {width:82px;height:77px;top:0;right:0;background:url(http://images.cnitblog.com/i/333689/201404/181538254946336.png) no-repeat;text-indent:-9999em;} .gallery-photo {width:100%;height:100%;position:absolute;top:50px;vertical-align:middle;text-align:center;} .gallery-photo span {height:100%;display:inline-block;vertical-align:middle;} .gallery-photo img {max-width:100%;max-height:100%;vertical-align:middle;cursor:pointer;} .gallery-thumb {width:100%;height:56px;position:absolute;bottom:50px;text-align:center;font-size:0;} .gallery-thumb a {width:50px;height:50px;overflow:hidden;margin:0 2px;display:inline-block;*zoom:1;border:3px solid transparent;opacity:.6;filter:alpha(opacity:60);} .gallery-thumb img {max-width:100px;max-height:100px;min-width:50px;min-height:50px;border:none;} .gallery-thumb .selected {border-color:#f60;opacity:1;filter:alpha(opacity:100);} </style>
</head>
<body style="height:2000px;">
<h1> </h1>
<p class="img">
<a href="http://images.cnitblog.com/i/333689/201403/181012241467455.jpg"><img src="http://images.cnitblog.com/i/333689/201403/181012064744754.jpg" alt=""></a>
<a href="http://images.cnitblog.com/i/333689/201403/181012428021756.jpg"><img src="http://images.cnitblog.com/i/333689/201403/181012349904375.jpg" alt=""></a>
<a href="http://images.cnitblog.com/i/333689/201403/181012573656772.jpg"><img src="http://images.cnitblog.com/i/333689/201403/181012512096320.jpg" alt=""></a>
<a href="http://images.cnitblog.com/i/333689/201403/181013163811731.jpg"><img src="http://images.cnitblog.com/i/333689/201403/181013035524683.jpg" alt=""></a>
<a href="http://images.cnitblog.com/i/333689/201403/181013442711411.jpg"><img src="http://images.cnitblog.com/i/333689/201403/181013354124216.jpg" alt=""></a>
</p>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script> /* * jquery gallery JS * ZhaoHuanLei - 20140418 */ ;(function($) { $.fn.extend({ gallery: function() { $(this).on("click", function() { var self = $(this), link = self.parent().find("a"), bd = $("body"); html = "\ <div class='gallery-overlay'>\ <div class='gallery-photo'><span></span><img src='"+ self.attr("href") +"'></div>\ <div class='gallery-thumb'></div>\ <a class='gallery-prev' href='javascript:;' title=' '><</a>\ <a class='gallery-next' href='javascript:;' title=' '>></a>\ <a class='gallery-close' href='javascript:;' title=' '>×</a>\ </div>\ "; bd.css("overflow-y", "hidden").append(html); var overlay = $(".gallery-overlay"), photo = $(".gallery-photo"), photoImg = photo.find("img"), thumb = $(".gallery-thumb"), prev = $(".gallery-prev"), next = $(".gallery-next"), close = $(".gallery-close"), str = ""; // , function toResize() { var height = $(window).height(); overlay.height(height); photo.css({"height": height - 200}); photoImg.css({"max-height": height - 200});// safari bug } toResize(); $(window).resize(function() { toResize(); }); // link.each(function() { var href = $(this).attr("href"), src = $(this).find("img").attr("src"), act = "<a href='"+ href +"'><img src='"+ src +"'/></a>"; str += act; }); thumb.append(str); // var thumbLink = thumb.find("a"), len = thumbLink.length - 1, index = link.index(this); function switchPhoto(index) { var _this = thumbLink.eq(index); _this.addClass("selected").siblings().removeClass("selected"); photo.find("img").attr("src", _this.attr("href")); } switchPhoto(index); thumb.on("click", "a", function() { index = thumbLink.index(this); switchPhoto(index); return false; }); // function switchPrev() { index--; if (index < 0) { index = len; } switchPhoto(index); } // function switchNext() { index++; if (index > len) { index = 0; } switchPhoto(index); } prev.on("click", function() { switchPrev(); }); next.on("click", function() { switchNext(); }); photo.on("click", "img", function() { switchNext(); }); // function closeOverlay() { overlay.remove(); bd.css("overflow-y", "auto"); } close.on("click", function() { closeOverlay(); }); return false; }); } }); })(jQuery); </script>
<script> $(function() { $('.img a').gallery(); }); </script>
</body>
</html>