msgbox.js为之前的QQ空间的提示效果插件。但是在iframe自适应高度之后,高度会变得很高,而msgbox是body区域垂直居中显示,而不是可视区域垂直居中。最终在iframe里就会变得定位错误,导致用户看不到提示内容。
修复:
ZENG.msgbox._setPosition = function (tips, timeout, topPosition) { timeout = timeout || 5000; var _s = ZENG.msgbox, bt = ZENG.dom.getScrollTop(), ch = ZENG.dom.getClientHeight(), t = Math.floor(ch / 2) - 40; ZENG.dom.setStyle(tips, "top", ((document.compatMode == "BackCompat" || ZENG.userAgent.ie < 7) ? bt : 0) + ((typeof (topPosition) == "number") ? topPosition : t) + "px"); //modify cat_qin 2015-4-2 if (self.frameElement && self.frameElement.tagName == "IFRAME") { $(".zeng_msgbox_layer_wrap").css("top", $(parent.window).scrollTop() + 200); } clearTimeout(_s._timer); tips.firstChild.style.display = ""; timeout && (_s._timer = setTimeout(_s.hide, timeout)); };