From b88cb0384d3e4c742baa1e808d63d33d7b2b0972 Mon Sep 17 00:00:00 2001 From: Anyon Date: Wed, 11 Apr 2018 14:36:47 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=94=B9=E5=8D=95?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0IE=E5=85=BC=E5=AE=B9=20#89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/admin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/static/admin.js b/static/admin.js index 97900b3df..2f9b82cec 100644 --- a/static/admin.js +++ b/static/admin.js @@ -479,8 +479,8 @@ $(function () { var name = $(this).attr('name') || 'image'; var type = $(this).data('type') || 'png,jpg'; var $tpl = $(''); - $(this).hide().attr('name', name).after($tpl).on('change', function () { - $tpl.get(0).style = this.value ? 'background-image:url(' + this.value + ')' : ''; + $(this).attr('name', name).after($tpl).on('change', function () { + !!this.value && $tpl.css('backgroundImage', 'url(' + this.value + ')'); }).trigger('change'); }; @@ -489,7 +489,7 @@ $(function () { var type = $(this).data('type') || 'png,jpg'; var name = $(this).attr('name') || 'umt-image'; var $tpl = $(''); - $(this).hide().attr('name', name).after($tpl).on('change', function () { + $(this).attr('name', name).after($tpl).on('change', function () { var input = this, values = [], srcs = this.value.split('|'); $(this).prevAll('.uploadimage').map(function () { values.push($(this).attr('data-tips-image'));