• 用PhotoSwipe制作相册,手势可放大


    1、引入css和js

              <link href="css/photoswipee.css" rel="stylesheet"  type="text/css"/>
              <link href="css/default-skin.css" rel="stylesheet"  type="text/css"/>
              <link rel="stylesheet" type="text/css" href="css/indexLarger.css">
              <script src="js/jquery.min.js" type="text/javascript"></script>
              <script src="js/photoswipe.min.js" type="text/javascript"></script>
              <script src="js/photoswipe-ui-default.min.js" type="text/javascript"></script>
              <script src="js/myswipe.js" type="text/javascript"></script>
    

    2、引用

                         <div class="gallery">
                            <a  href="images/thumb/001.jpg"  data-size="393x584" data-med="images/full/001.jpg" data-med-size="1179x1752">
                                <img src="images/thumb/001.jpg" alt="image 001" />
                            </a>
                            <a  href="images/thumb/002.jpg"  data-size="584x393" data-med="images/full/002.jpg" data-med-size="1752x1179">
                                <img src="images/thumb/002.jpg" alt="image 002" />
                            </a>
                            <a  href="images/thumb/003.jpg"  data-size="393x584" data-med="images/full/003.jpg" data-med-size="1179x1752">
                                <img src="images/thumb/003.jpg" alt="image 003" />
                            </a>
                            <a  href="images/thumb/004.jpg"  data-size="574x811" data-med="images/full/004.jpg" data-med-size="1752x1179">
                                <img src="images/thumb/004.jpg" alt="image 004" />
                            </a>
                            <a  href="images/thumb/005.jpg"  data-size="393x584" data-med="images/full/005.jpg" data-med-size="1179x1752">
                                <img src="images/thumb/005.jpg" alt="image 005" />
                            </a>
                        </div>
                        <!--photoSwipe-->
                          <div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
                                <div class="pswp__bg"></div>
                                <div class="pswp__scroll-wrap">
                                    <div class="pswp__container">
                                        <div class="pswp__item"></div>
                                        <div class="pswp__item"></div>
                                        <div class="pswp__item"></div>
                                    </div>
                                    <div class="pswp__ui pswp__ui--hidden">
                                        <div class="pswp__top-bar">
                                            <div class="pswp__counter"></div>
                                            <div class="pswp__preloader">
                                                <div class="pswp__preloader__icn">
                                                    <div class="pswp__preloader__cut">
                                                        <div class="pswp__preloader__donut"></div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="pswp__caption">
                                            <div class="pswp__caption__center">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                         </div>
    

    3、初始化

         

     initPhotoSwipeFromDOM('.gallery');  
    

      

  • 相关阅读:
    团队博客-十日冲刺6
    04构建之法阅读笔记之一
    Java基础-面向对象三大特性
    剑指 Offer 38. 字符串的排列
    Java基础:包装类 装箱/拆箱 Integer
    剑指 Offer 34. 二叉树中和为某一值的路径
    LeetCode 树:105. 从前序与中序遍历序列构造二叉树
    Java基础:类型
    Java基础:值传递和引用传递
    数据结构:图的基本知识
  • 原文地址:https://www.cnblogs.com/karila/p/6197797.html
Copyright © 2020-2023  润新知