iframe disappears for no apparent reason after dynamically creating it

北慕城南 提交于 2019-12-01 04:47:13

Quoting John Winkelman's post:

This is a Known Issue for Webkit browsers (Chrome, Safari). Sometimes, when updating an inline element or style, the browser does not redraw/repaint the screen until a block-level change happens in the DOM. This bug most often occurs when there is a lot going on in the page [...]

  • Fix 1:

    document.getElementById('myElement').style.webkitTransform = 'scale(1)'; 
  • Fix 2 in case the element isn't repainted when scrolling the page:

    document.addEventListener("scroll", function(event) {     var style = document.getElementById("name").style;     style.webkitTransform = style.webkitTransform ? "" : "scale(1)"; }); 

    This case was recently fixed in Chrome/Chromium.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!