Hexo博客Next主题相册搭建

blog文件夹/source下创建photos文件夹,在photos文件夹创建index.md文件,编辑index.md文件,写入以下代码:

<style type="text/css">
    
    .header-inner{
         display: none;
    }
    .sidebar{
        display: none;
    }
    .content{
        margin-bottom: 360px;
    }
    .content-wrap{
       width: 100%;
       // box-sizing: content-box;
       padding: initial !important;
       background:url('https://s2.ax1x.com/2019/09/07/nlL4pR.jpg');
    }
    
    .main-inner{
        width: 100%;
    }
    .main {
        padding-bottom: 150px;
        margin-top: 0px;
        background:url('https://s2.ax1x.com/2019/09/07/nlL4pR.jpg');
    }
    .main-inner{
        margin-top: unset;
    }
    .page-post-detail .post-meta{
        display: none;
    }
    body {
        background-image: unset;
        background-attachment: unset;
        background-size: 100%;
        /*background-position: top left;*/
    }
    .header{
        background: rgba(28, 25, 25, 0.6);
        border-bottom: unset;
    }
    .menu .menu-item a{
            font-weight: 300;
            color: #e6eaed;
    }
    .footer-inner {
         padding-left: 0px;
    }
    
    img:hover {
        //opacity:0.8; /*透明度*/
        //filter:alpha(opacity=100); /* For IE8 and earlier */
    }

    .imgbox{
        margin-top: 20px;
        padding: 1px 10px;
        width: 100%;
        overflow: hidden;
        height: 250px;
        border-right: 1px solid #bcbcbc;
        background:url('https://s2.ax1x.com/2019/09/07/nlL4pR.jpg');
    }
    .box{
        visibility: visible;
        overflow: auto; 
        zoom: 1;
    }
    .box li{
        float: left;
        width: 25%;
        position: relative;
        overflow: hidden;
        text-align: center;
        list-style: none;
        margin: 0;
        /*display: inline;*/
        padding: 0;
        height: 360px;
    }
    .box li span{
        display: block;
        padding: 12% 7% 10% 7%;
        min-height: 80px;
        //background: #fff;
        color: #fff;
        font-size: 16px;
        font-weight: 600;
        line-height: 26px;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
    }

    img.imgitem{
        padding: unset;
        padding: unset;
        border: unset;
        position: relative;
        padding: 0px;
        height: auto;
        width: 100%;
    }

    div#posts.posts-expand {
        border: unset;
        padding: unset;
        margin-bottom: 10px;
    }
    .posts-expand .post-body img{
        padding: 0px !important;
    }
    .box p{
        margin-top: -25px;
        display: block;
        background: #121212;
        color: #fff;
        font-size: 14px;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        text-align: center;
    }
    
    .box span strong{
        background: rgba(0,0,0,0.4);
        padding: 20px;
    }
    
    .posts-expand .post-title {
        display: none;
    }
    
    .title{
        margin: 10px auto;
        display: inline-block;
        vertical-align: middle;
        //background: url(/images/beichen.jpg);
        font: 85px/250px 'ChaletComprimeMilanSixty';
        //background-position: left bottom !important;
        background-position: center center !important;
        color: #fff;
        background-size: 100% auto !important; 
        -webkit-background-size: cover; 
        -moz-background-size: cover;
        -o-background-size: cover;
        width: 100%;
        text-align: center;
        border: unset;
        height: 560px;
        cursor: unset !important;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
    }

    @media (max-width: 767px){
        .box li {
            width: 98%;
        }
        .title {
            height: 200px;
        }
        
        .box span {
            min-height: 80px;
            border-right: unset;
            font-size: 17px;
        }
        .box p{
            border-right: unset;
            font-size: 12px;
          
        }
        .posts-expand {
            margin: unset;
        }
    
    }

    @media (min-width: 1600px){
    
        .container .main-inner{
            width: 100%;
        }
    }

</style>

<div id="box" class="box"></div>

<script type="text/javascript">
   
   // 相册json
   var json = 
    [
        [
            {
                'title': '七彩丹霞',
                'url': 'https://s2.ax1x.com/2019/09/07/nlRzZt.jpg'
            },
            {
                'title': '9月雨后',
                'url': 'https://s2.ax1x.com/2019/09/07/nlRvqI.jpg'
            },
            {
                'title': '五花肉',
                'url': 'https://s2.ax1x.com/2019/09/07/nlRbGD.jpg'
            },
            {
                'title': '五花肉+1',
                'url': 'https://s2.ax1x.com/2019/09/07/nlRHPO.jpg'
            },
            {
                'title': '别样的艳',
                'url': 'https://s2.ax1x.com/2019/09/07/nlRTIK.jpg'
            },
            {
                'title': '远处的城堡',
                'url': 'https://s2.ax1x.com/2019/09/07/nlRXMd.md.jpg'
            },
            {
                'title': '夕阳红',
                'url': 'https://s2.ax1x.com/2019/09/07/nlRqRe.md.jpg'
            },
            {
                'title': '卢浮宫',
                'url': 'https://s2.ax1x.com/2019/09/07/nlRIVx.md.jpg'
            },
            {
                'title': '景区一角',
                'url': 'https://s2.ax1x.com/2019/09/07/nlRhrR.md.jpg'
            },
            {
最后修改:2020 年 07 月 18 日 03 : 46 PM
如果觉得我的文章对你有用,请随意赞赏