Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,11 @@ math:
# To install 3.x: https://github.com/theme-next/theme-next-fancybox3
fancybox: false

# A JavaScript library for zooming images like Medium.
# Do not enable both `fancybox` and `mediumzoom`.
# Dependencies: https://github.com/theme-next/theme-next-mediumzoom
mediumzoom: false

# Polyfill to remove click delays on browsers with touch UIs.
# Dependencies: https://github.com/theme-next/theme-next-fastclick
fastclick: false
Expand Down Expand Up @@ -1005,6 +1010,12 @@ vendors:
fancybox:
fancybox_css:

# Internal version: 1.0.4
# See: https://github.com/francoischalifour/medium-zoom
# Example:
# mediumzoom: //cdn.jsdelivr.net/npm/medium-zoom@1/dist/medium-zoom.min.js
mediumzoom:

# Internal version: 1.0.6
# See: https://github.com/ftlabs/fastclick
# Example:
Expand Down
1 change: 1 addition & 0 deletions layout/_partials/head/head.swig
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
back2top: {{ theme.back2top | json_encode }},
copycode: {{ theme.codeblock.copy_button | json_encode }},
fancybox: {{ theme.fancybox }},
mediumzoom: {{ theme.mediumzoom }},
fastclick: {{ theme.fastclick }},
lazyload: {{ theme.lazyload }},
tabs: {{ theme.tabs.enable }},
Expand Down
4 changes: 4 additions & 0 deletions layout/_scripts/vendors.swig
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
{% set js_vendors.fancybox = 'fancybox/source/jquery.fancybox.pack.js' %}
{% endif %}

{% if theme.mediumzoom %}
{% set js_vendors.mediumzoom = 'mediumzoom/medium-zoom.min.js' %}
{% endif %}

{% if theme.canvas_nest.enable %}
{% if theme.canvas_nest.onmobile %}
{% set canvas_nest_uri = url_for(theme.vendors._internal + '/canvas-nest/canvas-nest.min.js') %}
Expand Down
3 changes: 2 additions & 1 deletion source/js/next-boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $(document).ready(function() {
* Need to add config option in Front-End at 'layout/_partials/head.swig' file.
*/
CONFIG.fastclick && NexT.utils.isMobile() && window.FastClick.attach(document.body);
CONFIG.lazyload && NexT.utils.lazyLoadPostsImages();
CONFIG.lazyload && window.lozad('.post-body img').observe();

NexT.utils.registerESCKeyEvent();

Expand All @@ -27,6 +27,7 @@ $(document).ready(function() {
});

CONFIG.fancybox && NexT.utils.wrapImageWithFancyBox();
CONFIG.mediumzoom && window.mediumZoom('.post-body img');
CONFIG.copycode.enable && NexT.utils.registerCopyCode();
CONFIG.tabs && NexT.utils.registerTabsTag();

Expand Down
6 changes: 1 addition & 5 deletions source/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
NexT.utils = {

/**
* Wrap images with fancybox support.
* Wrap images with fancybox.
*/
wrapImageWithFancyBox: function() {
$('.content img')
Expand Down Expand Up @@ -45,10 +45,6 @@ NexT.utils = {
});
},

lazyLoadPostsImages: function() {
lozad('.content img').observe();
},

/**
* One-click copy code support.
*/
Expand Down