popup 弹出层弹出窗口 包括图片组浏览,ajax载入,地图等
代码仅仅只显示一部分,更多内容请看演示页面
XML/HTML Code
- <a class="image-popup-vertical-fit" href="../dalian.jpg" title="Caption. Can be aligned it to any side."> <img src="../dalian.jpg" width="75" height="75"> </a> <a class="image-popup-fit-width" href="../dandong.png" title="This image fits only horizontally."> <img src="../dandong.png" width="75" height="75"> </a>
- <script>
- $(document).ready(function() {
- $('.image-popup-vertical-fit').magnificPopup({
- type: 'image',
- closeOnContentClick: true,
- mainClass: 'mfp-img-mobile',
- image: {
- verticalFit: true
- }
- });
- $('.image-popup-fit-width').magnificPopup({
- type: 'image',
- closeOnContentClick: true,
- image: {
- verticalFit: false
- }
- });
- $('.image-popup-no-margins').magnificPopup({
- type: 'image',
- closeOnContentClick: true,
- closeBtnInside: false,
- mainClass: 'mfp-no-margins', // class to remove default margin from left and right side
- image: {
- verticalFit: true
- }
- });
- });
- </script>
- <h2>Lightbox gallery</h2>
- <div class="popup-gallery"> <a href="../dalian.jpg" title="The Cleaner"><img src="../dalian.jpg" width="75" height="75"></a> <a href="http://farm9.staticflickr.com/8382/8558295631_0f56c1284f_b.jpg" title="Winter Dance"><img src="http://farm9.staticflickr.com/8382/8558295631_0f56c1284f_s.jpg" width="75" height="75"></a> <a href="../demo1.jpg" title="The Uninvited Guest"><img src="../demo1.jpg" width="75" height="75"></a> <a href="../demo2.jpg" title="Oh no, not again!"><img src="../demo2.jpg" width="75" height="75"></a> </div>
- <script>
- $(document).ready(function() {
- $('.popup-gallery').magnificPopup({
- delegate: 'a',
- type: 'image',
- tLoading: 'Loading image #%curr%...',
- mainClass: 'mfp-img-mobile',
- gallery: {
- enabled: true,
- navigateByImgClick: true,
- preload: [0,1] // Will preload 0 - before current, and 1 after the current image
- },
- image: {
- tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
- titleSrc: function(item) {
- return item.el.attr('title') + '<small>by Marsel Van Oosten</small>';
- }
- }
- });
- });
- </script>
原文地址:http://www.freejs.net/article_jquerywenzi_197.html