重绘布局与IE8 inline-block不撑开bug修复实例页面
回到相关文章 »代码:
CSS代码:
.box { display: inline-block; padding: 10px; background-color: #f0f3f9; } .box p { width: 256px; } .dn { display: none; } .wait { background-color:#fff; }
HTML代码:
<div id="box" class="box"> <div class="inner"> <img src="//image.zhangxinxu.com/image/study/s/s256/mm1.jpg" /> <p>在... <span id="more" class="dn">新浪员工刘彬表...</span></p> <p> <a href="javascript:" data-rel="more">展开更多(bug)</a> <a href="javascript:" data-rel="more">展开更多(bug fixed)</a> </p> </div> </div> <p class="wait">我是在下面等shi的~</p>
JS代码:
(function(document) { var eleBox = document.getElementById("box"), eleMore = eleBox && eleBox.getElementsByTagName("a"), length = eleMore && eleMore.length; if (!length) return; for (var i=0; i<length; i+=1) { eleMore[i].onclick = function() { var idMore = this.getAttribute("data-rel"), target = null; if (idMore && (target = document.getElementById(idMore))) { var html = this.innerHTML; if (target.style.display === "inline") { target.style.display = "none"; this.innerHTML = html.replace("收起", "展开"); if (/fixed/.test(html)) { eleBox.style.visibility = "inherit"; } } else { target.style.display = "inline"; this.innerHTML = html.replace("展开", "收起"); if (/fixed/.test(html)) { eleBox.style.visibility = "visible"; } } } return false; }; } })(document);
效果:

在twitter上看到今天中午新浪微博抽风的解释:“21日中午12点半至1点15分,新浪微博管理员徐某使用服务器带宽下载CL网爱情动作片42G左右,造成新浪微博无法访问,目前徐某已被停职,所下载的影片硬盘已被领导没收。(人家45分钟下了42G,果然是大公司)。” 新浪员工刘彬表示这是子虚乌有黑我渣浪让人愤怒的事情!
我是在下面等shi的~