From aee5433838d6b1d91a26ab2ee76afac2fa71c7e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Tue, 19 Apr 2022 23:37:23 +0800 Subject: [PATCH] Update login.js --- public/static/login.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/public/static/login.js b/public/static/login.js index 630c56624..e3515d959 100644 --- a/public/static/login.js +++ b/public/static/login.js @@ -17,13 +17,14 @@ $(function () { window.$body = $('body'); /*! 后台界面背景切换 */ - $('[data-supersized]').map(function () { - var idx = 0, imgs = []; - window.setInterval(function () { - imgs.length > 0 && $body.css({backgroundImage: 'url(' + (imgs[++idx] || imgs[idx = 0]) + ')'}); - }, 5000) && this.dataset.supersized.split(',').forEach(function (url) { + $('[data-supersized]').each(function (i, el) { + el.idx = 0, el.imgs = [], el.state = setInterval(function () { + el.imgs.length > 0 && $body.css({ + backgroundImage: 'url(' + (el.imgs[++el.idx] || el.imgs[el.idx = 0]) + ')' + }); + }, 5000) && el.dataset.supersized.split(',').forEach(function (url) { layui.img(url, function () { - imgs.push(url); + el.imgs.push(url); }); }); });