From 21facc9e8771785a17eeb639ab6266887b47cf3d Mon Sep 17 00:00:00 2001 From: filesite Date: Thu, 22 Aug 2024 17:22:43 +0800 Subject: [PATCH] improve fancybox toolbar for mobile --- www/js/beauty.js | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/www/js/beauty.js b/www/js/beauty.js index e1d17f8..3b718c4 100644 --- a/www/js/beauty.js +++ b/www/js/beauty.js @@ -86,22 +86,37 @@ if ($('#image_site').get(0)) { }; // 图片浏览 - Fancybox.bind('[data-fancybox]', { - Toolbar: { - display: { - left: ["infobar"], - middle: [ + var fancyboxToolbar = { + display: { + left: ["infobar"], + middle: [ "zoomIn", "zoomOut", "toggle1to1", "rotateCCW", "rotateCW", "flipX", - "flipY", - ], - right: ["slideshow", "fullscreen", "thumbs", "download", "close"], - }, + "flipY" + ], + right: ["slideshow", "fullscreen", "thumbs", "download", "close"], }, + }; + if ($(window).width() < 640) { //小屏幕只显示部分按钮 + fancyboxToolbar = { + display: { + left: ["infobar"], + middle: [ + "zoomIn", + "zoomOut", + "rotateCCW", + "rotateCW" + ], + right: ["download", "close"] + } + }; + } + Fancybox.bind('[data-fancybox]', { + Toolbar: fancyboxToolbar, loop: true, smallBtn: false, iframe: {