Skip to content

Commit

Permalink
fixed: 修复医疗广告页底部 placeholder 高度获取不正确的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zoumiaojiang authored and yenshih committed Dec 29, 2018
1 parent 7c5fae6 commit eb1b1a9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/mip-custom/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
});
Expand Down Expand Up @@ -305,7 +312,7 @@ define(function (require) {
*/
function getConfigScriptElement(elem) {
if (!elem) {
return;
return;
}
return elem.querySelector('script[type="application/json"]');
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit eb1b1a9

Please sign in to comment.