photosWide 小白实例demo 实现图片在移动端和PC端缩放 可直接替换使用

photoswide
在这里插入图片描述
帮你们打包蓝奏云:
Dijia

<!DOCTYPE html>
<html lang="en" prefix="og: https://ogp.me/ns#" debug="true"
      class="wf-myriadpro-n4-active wf-myriadpro-n6-active wf-active">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Dijah,ティガ</title>
    <meta name="viewport" content="width = device-width, initial-scale = 1.0">
    <meta name="author" content="Dijah">
</head>
<body>

<!--自定义图片 Dijia/1.jpg-->
<div class="section section--head">
    <!--自定义图片 Dijia/1.jpg-->
    <div class="row">
        <div id="demo-test-gallery" class="demo-gallery" data-pswp-uid="1">

            <a href="Dijia/1.jpg"
               data-size="1600x1600" data-med="Dijia/1.jpg"
               data-med-size="1024x1024"
               class="Dijia/1.jpg">
                <img src="Dijia/1.jpg" alt="">
                <figure></figure>

            </a><a href="Dijia/2.jpg"
                   data-size="1600x1600" data-med="Dijia/2.jpg"
                   data-med-size="1024x1024"
                   class="Dijia/2.jpg">
            <img src="Dijia/2.jpg" alt="">
            <figure></figure>
        </a>
        </div>
    </div>
</div>


<!--各种属性和链接可不看-->
<div>
    <link href="./Dijia/site.css" rel="stylesheet">
    <link href="./Dijia/photoswipe.css" rel="stylesheet">
    <link href="./Dijia/default-skin.css" rel="stylesheet">
    <script type="text/javascript" async=""
            src="./Dijia/watch.js"></script>
    <script async="" src="./Dijia/analytics.js"></script>
    <script src="./Dijia/photoswipe.min.js"></script>
    <script src="./Dijia/photoswipe-ui-default.min.js"></script>
    <script src="Dijia/snf1yod.js"></script>
    <style type="text/css">.tk-myriad-pro {
    
        font-family: "myriad-pro", sans-serif;
    }</style>
    <style type="text/css">@font-face {
    
        font-family: myriad-pro;
        src: url(https://use.typekit.net/af/9bffeb/0000000000000000000151e0/23/l?subset_id=2&fvd=n4&v=3) format("woff2"), url(https://use.typekit.net/af/9bffeb/0000000000000000000151e0/23/d?subset_id=2&fvd=n4&v=3) format("woff"), url(https://use.typekit.net/af/9bffeb/0000000000000000000151e0/23/a?subset_id=2&fvd=n4&v=3) format("opentype");
        font-weight: 400;
        font-style: normal;
        font-display: auto;
    }
    @font-face {
    
        font-family: myriad-pro;
        src: url(https://use.typekit.net/af/5e21d4/0000000000000000000151e1/23/l?subset_id=2&fvd=n6&v=3) format("woff2"), url(https://use.typekit.net/af/5e21d4/0000000000000000000151e1/23/d?subset_id=2&fvd=n6&v=3) format("woff"), url(https://use.typekit.net/af/5e21d4/0000000000000000000151e1/23/a?subset_id=2&fvd=n6&v=3) format("opentype");
        font-weight: 600;
        font-style: normal;
        font-display: auto;
    }</style>
    <script>
        $(function () {
    
            $('.pswp__img').css("width", "34%").css("height", "86%");

        })
        try {
    
            Typekit.load();
        } catch (e) {
    
        }</script>
    <script>
        document.createElement('figure');
    </script>
    <style type="text/css">
        input[type="text"],
        input[type="email"] {
    
            font-size: 18px;
            line-height: 25px;
            height: 32px;
            width: 250px;
            border: 1px #d0d0d0 solid;
            margin: 0 0 10px 0;
            padding: 4px
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
你可以通过使用 `dosamigos/gallery` 组件来显示图片相册,并进行自定义布局。首先,确保已经安装了该组件,可以通过以下命令在你的项目中安装: ``` composer require 2amigos/yii2-gallery-widget ``` 安装完成后,在你的视图文件中使用以下代码来显示图片相册: ```php use dosamigos\gallery\Gallery; // 图片数据数组 $items = [ [ 'url' => 'path/to/image1.jpg', 'src' => 'path/to/image1.jpg', 'options' => ['title' => 'Image 1'], ], [ 'url' => 'path/to/image2.jpg', 'src' => 'path/to/image2.jpg', 'options' => ['title' => 'Image 2'], ], // 其他图片项... ]; // 自定义布局选项 $layoutOptions = [ 'galleryOptions' => [ 'class' => 'gallery-widget', 'data-pswp-width' => '800', 'data-pswp-height' => '600', ], 'options' => [ 'class' => 'gallery-widget', ], 'templateOptions' => [ 'class' => 'gallery-widget', ], ]; echo Gallery::widget([ 'items' => $items, 'options' => $layoutOptions['galleryOptions'], 'templateOptions' => $layoutOptions['templateOptions'], 'clientOptions' => [ 'gallery' => true, 'galleryOptions' => [ 'showAnimationDuration' => 0, 'hideAnimationDuration' => 0, ], ], ]); ``` 上述代码中,`$items` 数组包含了每个图片项的URL、源文件路径和其他选项。你可以根据需要调整和添加更多的图片项。 `$layoutOptions` 数组包含了自定义布局的选项。你可以根据你的需求进行修改。 通过使用 `Gallery::widget()` 方法,传入图片项数组和布局选项,即可显示图片相册。 请注意,这只是一个简单的示例,你可以根据你的实际需求进行更多的自定义和调整。详细的使用文档和更多示例可以在 `dosamigos/gallery` 组件的官方文档中找到。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值