🚀 fix: albums display

This commit is contained in:
沈宇 2020-03-16 11:24:54 +08:00
parent 68b1022367
commit a9473d4d22
7 changed files with 24 additions and 48 deletions

View File

@ -182,9 +182,6 @@ github:
# (Set false if you don't need) # (Set false if you don't need)
url: https://github.com/Shen-Yu/hexo-theme-ayer url: https://github.com/Shen-Yu/hexo-theme-ayer
# fancybox(Use for gallery, set false if you don't need)
fancybox: true
# pv&uv statistics # pv&uv statistics
busuanzi: busuanzi:
enable: true enable: true

View File

@ -130,9 +130,6 @@ github:
# (关闭请设置为false) # (关闭请设置为false)
url: https://github.com/Shen-Yu/hexo-theme-ayer url: https://github.com/Shen-Yu/hexo-theme-ayer
# fancybox(仅用于相册展示若需要可配置albums)
fancybox: true
# 访问量统计(不蒜子) # 访问量统计(不蒜子)
busuanzi: busuanzi:
enable: true enable: true

View File

@ -48,7 +48,7 @@
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>
<%- js('js/ayer') %> <%- js('js/ayer') %>
<% if (theme.image_viewer && is_post()){ %> <% if (theme.image_viewer){ %>
<%- partial('viewer') %> <%- partial('viewer') %>
<% } %> <% } %>
<% if (theme.mathjax){ %> <% if (theme.mathjax){ %>
@ -63,4 +63,4 @@
<%- js('/js/busuanzi-2.3.pure.min') %> <%- js('/js/busuanzi-2.3.pure.min') %>
<% } %> <% } %>
<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script> <script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>

View File

@ -1,18 +1,17 @@
<% if (post.albums && post.albums.length){ %> <% if (post.albums && post.albums.length){ %>
<div class="article-albums"> <div class="article-albums">
<ul class="article-albums-photos" id="basicExample"> <ul class="article-albums-photos" id="basicExample">
<% post.albums.forEach(function(photo){ %> <% post.albums.forEach(function(photo){ %>
<li class="article-albums-item" data-scroll-reveal> <li class="article-albums-item" data-scroll-reveal>
<a class="article-albums-img fancybox" data-fancybox="images" data-caption="<%- photo[1] %>" href="<%- url_for(photo[0]) %>" rel="gallery_<%= post._id %>" title="<%- photo[1] %>"> <img class="lazy" data-original="<%- url_for(photo[0]) %>" itemprop="image" alt="<%- photo[1] %>"
<img class="lazy" data-original="<%- url_for(photo[0]) %>" itemprop="image" alt="<%- photo[1] %>"> style="cursor: pointer;">
</a> <% if (photo && photo.length > 1){ %>
<% if (photo && photo.length > 1){ %> <span class="article-albums-caption"> <%- photo[1] %> </span>
<span class="article-albums-caption"> <%- photo[1] %> </span> <% } %>
<% } %> </li>
</li>
<% }) %> <% }) %>
</ul> </ul>
</div> </div>
<% } %> <% } %>

View File

@ -1,12 +1,9 @@
<% if (post.albums && post.albums.length){ %> <% if (post.albums && post.albums.length){ %>
<div class="justified-gallery" id="gallery"> <div class="justified-gallery" id="gallery">
<% post.albums.forEach(function(photo){ %> <% post.albums.forEach(function(photo){ %>
<div> <div>
<a class="fancybox" data-fancybox="images" data-caption="<%- photo[1] %>" href="<%- url_for(photo[0]) %>" rel="gallery_<%= post._id %>" title="<%- photo[1] %>"> <img src="<%- url_for(photo[0]) %>" itemprop="image" alt="<%- photo[1] %>" style="cursor: pointer;">
<img src="<%- url_for(photo[0]) %>" itemprop="image" alt="<%- photo[1] %>">
</a>
</div>
<% }) %>
</div> </div>
<% } %> <% }) %>
</div>
<% } %>

View File

@ -66,7 +66,7 @@
</div> </div>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.min.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

View File

@ -1,5 +1,4 @@
(function ($) { (function ($) {
//
// Search // Search
var $searchWrap = $('.search-form-wrap'), var $searchWrap = $('.search-form-wrap'),
isSearchAnim = false, isSearchAnim = false,
@ -32,7 +31,6 @@
} }
}); });
//
// 移动设备侦测 // 移动设备侦测
var isMobile = { var isMobile = {
Android: function () { Android: function () {
@ -55,7 +53,6 @@
} }
}; };
//
// 建议在移动端不初始化,其实 /search.xml 文件还挺大的, // 建议在移动端不初始化,其实 /search.xml 文件还挺大的,
if ($('.local-search').size()) { if ($('.local-search').size()) {
$.getScript('/js/search.js', function () { $.getScript('/js/search.js', function () {
@ -63,25 +60,14 @@
}); });
} }
//
// Share // Share
$('.share-outer').click(()=>$('.share-wrap').fadeToggle()) $('.share-outer').click(() => $('.share-wrap').fadeToggle())
//
// fancybox
if ($.fancybox) {
$('[data-fancybox]').fancybox({
protect: true
});
}
//
// lazyload // lazyload
$("img.lazy").lazyload({ $("img.lazy").lazyload({
effect: "fadeIn" effect: "fadeIn"
}); });
//
// justifiedGallery // justifiedGallery
$('#gallery').justifiedGallery({ $('#gallery').justifiedGallery({
rowHeight: 200, rowHeight: 200,