Last active
August 29, 2015 14:11
-
-
Save 21paradox/6939cf0b83d4621e52cf to your computer and use it in GitHub Desktop.
IE6 css expression shims
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ie6 maxHeight shim | |
.maxHeight { | |
max-hegiht: 182px; | |
_height: expression(this.scrollHeight > 182 ? '182' : this.scrollHeight); | |
} | |
ie6 maxWidth shim | |
.maxWidth { | |
max-width: 396px; | |
_width: ~"expression(this.scrollWidth > 396 ? '396' : this.scrollWidth)"; | |
} | |
.maxAndMinHeight{ | |
min-height: 49px; | |
max-height: 200px; | |
_height: ~"expression((function(self){if(self.scrollHeight>200){return'200px'}else if(self.scrollHeight<49){return'49px'}else{return self.scrollHeight}}(this)))"; | |
/* | |
(function (self) { | |
if (this.scrollHeight > 200) { | |
return '200px'; | |
} else if (this.scrollHeight < 49) { | |
return '49px'; | |
} else { | |
return this.scrollHeight; | |
} | |
}(this)) | |
*/ | |
} | |
.centerElementInPage { | |
position: fixed; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
width: 400px; | |
height: 400px; | |
background: red; | |
margin: auto; | |
_position: absolute; | |
_left: expression(document.body.clientWidth/2- this.offsetWidth/2); | |
_top: expression(document.documentElement.scrollTop/2 + document.documentElement.clientHeight/2 - this.offsetHeight/2); | |
z-index: 200; | |
} | |
.mask { | |
position: absolute; | |
left: 0px; | |
top: 0px; | |
height: 100%; | |
width: 100%; | |
opacity: 0.7; | |
z-index: 100; | |
_top: expression(document.documentElement.scrollTop+ document.documentElement.clientHeight- this.offsetHeight); | |
_height: expression(document.documentElement.clientHeight); | |
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50); | |
background: black; | |
zoom: 1; | |
} | |
/* | |
ie6 caculate posotion absolute width fromchildren | |
(function (self) { | |
var nodes = self.childNodes; | |
var width = 0; | |
for(var i=0; i< nodes.length; i++) { | |
if(nodes[i].nodeType == 1){ | |
width += nodes[i].scrollWidth; | |
} | |
} | |
return width > 454 ? width : 454; | |
})(this); | |
*/ | |
.positionAbsoluteAutoWidth { | |
width: auto; | |
_width: expression((function(a){var b=a.childNodes;var c=0;for(var i=0;i<b.length;i++){if(b[i].nodeType==1){c+=b[i].scrollWidth}}return c>454?c:454})(this)); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment