From eb1b1a9e38c44085143e9c1f2c6b4fba22a9729f Mon Sep 17 00:00:00 2001 From: zoumiaojiang Date: Sat, 29 Dec 2018 13:58:50 +0800 Subject: [PATCH] =?UTF-8?q?fixed:=20=E4=BF=AE=E5=A4=8D=E5=8C=BB=E7=96=97?= =?UTF-8?q?=E5=B9=BF=E5=91=8A=E9=A1=B5=E5=BA=95=E9=83=A8=20placeholder=20?= =?UTF-8?q?=E9=AB=98=E5=BA=A6=E8=8E=B7=E5=8F=96=E4=B8=8D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mip-custom/dom.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mip-custom/dom.js b/src/mip-custom/dom.js index 329b9e75c..2a4cebf16 100644 --- a/src/mip-custom/dom.js +++ b/src/mip-custom/dom.js @@ -211,7 +211,14 @@ define(function (require) { if (zIndex >= maxzIndex) { maxzIndex = zIndex; - fixedElement.setPlaceholder(getCss(res.element, 'height') - excr); + var now = Date.now(); + var timer = setInterval(function () { + var height = getCss(res.element, 'height'); + if (height > 0 || Date.now() - now > 8000) { + clearInterval(timer); + } + fixedElement.setPlaceholder(height - excr); + }, 16); } } }); @@ -305,7 +312,7 @@ define(function (require) { */ function getConfigScriptElement(elem) { if (!elem) { - return; + return; } return elem.querySelector('script[type="application/json"]'); } @@ -333,10 +340,10 @@ define(function (require) { var me = this; this.placeholder.classList.add('fadeout'); // 占位符增加淡出效果 - this.placeholder.addEventListener("transitionend", function() { + this.placeholder.addEventListener('transitionend', function () { me.placeholder.remove(); }, false); - this.placeholder.addEventListener("webkitTransitionend", function() { + this.placeholder.addEventListener('webkitTransitionend', function () { me.placeholder.remove(); }, false); }