code前端
2015-08-03 11:32
var display = this.currentStyle? this.currentStyle.display: window.getComputedStyle(this, null).display;
老师能不能解释下这句话?
var display = this.style.display不行吗?
这是一个if else 简写
if(this.currentStyle){
this.currentStyle.display
}else{
window.getComputedStyle(this, null).display;
}主要是为了兼容IE
this.style.display不能获取外部CSS样式
CSS深入理解之float浮动
75954 学习 · 467 问题
相似问题