PhotoSwipe is very easy & powerful library for gallery.
First step - prepare file.
You get library phothswipe site & unzip. and copy to your project folder.
My case, I copy to C:/Program Files (x86)/Apache Group/Apache2/htdocs/photoswipe/
Second step - add library.
Change to photswipe's jquery library.
Add this code.
- <!--photoswipe css-->
- <link rel="stylesheet" href="photoswipe/lib/jquery.mobile-1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
- <link href="photoswipe/photoswipe.css" type="text/css" rel="stylesheet"/>
- <style type="text/css">
- div.gallery-row:after { clear: both; content: "."; display: block; height: 0; visibility: hidden; }
- div.gallery-item { float: left; width: 33.333333%; }
- div.gallery-item a { display: block; margin: 5px; border: 1px solid #3c3c3c; }
- div.gallery-item img { display: block; width: 100%; height: auto; }
- #Gallery1 .ui-content, #Gallery2 .ui-content { overflow: hidden; }
- </style>
- <!--photoswipe js-->
- <script type="text/javascript" src="photoswipe/lib/jquery-1.6.1.min.js"></script>
- <script type="text/javascript" src="photoswipe/lib/jquery.mobile-1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
- <script src="photoswipe/lib/simple-inheritance.min.js" type="text/javascript"></script>
- <script src="photoswipe/lib/jquery.animate-enhanced.min.js" type="text/javascript"></script>
- <script src="photoswipe/code-photoswipe-jQuery-1.0.11.min.js"></script>
- <script type="text/javascript">
- $(document).ready(function(e) {
- $('div.gallery-page').live('pageshow',function(e){
- $("div.gallery a", e.target).photoSwipe();
- return true;
- })
- });
- </script>
Third step - Implement gallery.
- <div data-role="page" id="equip-image" class="gallery-page">
- <div data-role="header" data-position="fixed" >
- <h1>Equipment Image</h1>
- <a href="#page" data-role="button" data-icon="home" data-iconpos="notext" class="ui-btn-right" data-iconshadow="false">
- </a>
- </div>
- <div data-role="content">
- <div class="gallery">
- <div class="gallery-row">
- <div class="gallery-item">
- <a href="http://jme21.co.kr/004/images/eqip_01_01.jpg" rel="external">
- <img src="http://jme21.co.kr/004/images/eqip_01_01.jpg" alt="TSA-J"/>
- </a>
- </div>
- <div class="gallery-item">
- .....
- </div>
- </div>
- </div>
- <div data-role="footer" align="center" data-position="fixed">
- <img width="100%" src="http://jme21.co.kr/images/copyright_05.jpg" />
- </div>
- </div>
In content tag you consist
<div class="gallery">
<div class="gallery-row">
<div class="gallery-item>
<a href="img src"><img src=thumb nail img alt=image name/>
</div>
</div>
</div>
You can see this...
If you click image..
You can see gallery.
No comments:
Post a Comment