Skip to content

Commit

Permalink
Fix fancybox & medium-zoom for hexo asset_img tag (theme-next#1166)
Browse files Browse the repository at this point in the history
  • Loading branch information
sankoshine authored and stevenjoezhang committed Sep 19, 2019
1 parent d5702a2 commit a5adb5b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/js/next-boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ NexT.boot.refresh = function() {
* Need to add config option in Front-End at 'layout/_partials/head.swig' file.
*/
CONFIG.fancybox && NexT.utils.wrapImageWithFancyBox();
CONFIG.mediumzoom && window.mediumZoom('.post-body :not(a) > img');
CONFIG.mediumzoom && window.mediumZoom('.post-body :not(a) > img, .post-body > img');
CONFIG.lazyload && window.lozad('.post-body img').observe();
CONFIG.pangu && window.pangu.spacingPage();

Expand Down
2 changes: 1 addition & 1 deletion source/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ NexT.utils = {
* Wrap images with fancybox.
*/
wrapImageWithFancyBox: function() {
document.querySelectorAll('.post-body :not(a) > img').forEach(element => {
document.querySelectorAll('.post-body :not(a) > img, .post-body > img').forEach(element => {
var $image = $(element);
var imageLink = $image.attr('data-src') || $image.attr('src');
var $imageWrapLink = $image.wrap(`<a class="fancybox fancybox.image" href="${imageLink}" itemscope itemtype="http://schema.org/ImageObject" itemprop="url"></a>`).parent('a');
Expand Down

0 comments on commit a5adb5b

Please sign in to comment.