
Originally Posted by
Nile
Well, to do that put this inside the lightbox.js:
Code:
if(!document.all){
function fixedIE(tl, n, el){
. . . .
And put this inside a CSS file:
Code:
* html #overlay {
top:expression(fixedIE('Top',0));
left:expression(fixedIE('Left',0));
}
That will NOT work. if(!document.all) excludes all IE, and * html #overlay only selects for IE 6 and less.
If you are concerned with getting the code off of the page, the best approach would be to create two additional files:
ie_lb.css:
Code:
#overlay {
top:expression(fixedIE('Top',0));
left:expression(fixedIE('Left',0));
}
and ie_lb.js:
Code:
function fixedIE(tl, n, el){
var sc = 'scroll'+tl, d = document, c = 'compatMode',
b = d[c]&&d[c]=='CSS1Compat'? d.documentElement : d.body;
n = n-0; if(typeof n!='number')return 0;
if(/^(Top|Left)$/.test(tl))
return b[sc]+n+'px';
if(/^(Bottom|Right)$/.test(tl)&&typeof el=='object'){
tl = tl=='Right'? 'Left' : 'Top', sc = 'scroll'+tl;
var dim = 'client' + (tl=='Top'? 'Height' : 'Width');
return b[sc]+b[dim]-el[dim]-n+'px';
}
return 0;
}
You could then replace the code on the page with this:
Code:
<!--[if IE]>
<script type="text/javascript" src="ie_lb.js"></script>
<link rel="stylesheet" href="ie_lb.css" type="text/css">
<![endif]-->
Just make sure that the src and href attributes point to the files' actual locations on your server.
Bookmarks