github

Fancybox照片插件示例

<!DOCTYPE html>
<html>
    <head>
        <title>Fancybox照片插件</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="js/fancybox.umd.js" type="text/javascript"></script>
        <link href="css/fancybox.css" rel="stylesheet" type="text/css"/>
        <style type="text/css">
            body{width: 1200px; margin: 10px auto;}
            .photo img{width: 100%;}
        </style>
    </head>
    <body>
        <div class="photo">
            <a href="img/1_updated.jpg" data-fancybox="gallery" >
                <img src="img/1_updated.jpg" alt="图片1">
            </a>
            <a href="img/2_updated.jpg" data-fancybox="gallery" >
                <img src="img/2_updated.jpg" alt="图片2">
            </a>
            <a href="img/3_updated.jpg" data-fancybox="gallery" >
                <img src="img/3_updated.jpg" alt="图片3">
            </a>
            <a href="img/4_updated.jpg" data-fancybox="gallery" >
                <img src="img/4_updated.jpg" alt="图片4">
            </a>
        </div>
    <script>
//        (function() {   // ① 函数定义
//            // 代码...
//        })();           // ② 立即调用
        (function() {
            Fancybox.bind("[data-fancybox]", {
                Toolbar: {
                    display: {
                        left: ["infobar"],
                        middle: [
                            "zoomIn",
                            "zoomOut",
                            "toggle1to1",
                            "rotateCCW",
                            "rotateCW",
                            "flipX",
                            "flipY",
                        ],
                        right: ["slideshow", "thumbs", "close"],
                    },
                },
            });
        })();    
    </script>
    </body>
</html>

参考链接:
https://cloud.tencent.com/developer/article/2425929

官网:https://fancyapps.com/

posted @ 2026-09-15 16:06  博讯科技工作室  阅读(7)  评论(0)    收藏  举报

赣州博讯科技工作室

©2019

回到顶部
回到底部
公众号 视博web工作室