IE7 Quirks mode fix

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

IE7 Quirks mode fix

Here are some changes to enable shadowbox to display content for IE7 in Quirks mode.
The fix does 2 things:
a) it adds simulated vertical fixed positioning for IE7 (Quirks mode)
b) it adds simulated horizontal fixed positioning for both IE6 (Quirks and Standard mode) and IE7 (Quirks mode)

Please note! : the changes below have NOT been comprehensively tested against all possible media types, or all possible configuration options - they work for my own immediate needs, which is inline display of HTML content. It is not perfect - IE6 still jumps from its initial resize position to its new position with scroll accounted for, but to solve that requires moving the scroll calculations around it bit more.

With reference to the current (at the time of writing) version of shadowbox (SVN version 75 2008-02-21):

line 618(ish)...

//Wizzud...(IE7 in quirks mode also requires absolute positioning instead of fixed)
//    var absolute_pos = isIE && !isIE7;
    var absolute_pos = isIE && (!isIE7 || !isStrict);

line 1637(ish) in centerVertically function...

//Wizzud...(IE7 quirks mode)
//        var scroll = document.documentElement.;
        var scroll = document.documentElement.scrollTop || document.body.scrollTop;
        var s_top = scroll + Math.round((SL.getViewportHeight() - (shadowbox.offsetHeight || 0)) / 2);
        SL.setStyle(shadowbox, 'top', s_top + 'px');
//Wizzud...(centre IE horizontally)
        SL.setStyle(shadowbox, 'left', (document.documentElement.scrollLeft || document.body.scrollLeft) + 'px');

line 1677(ish) in adjustHeight function...

//Wizzud...(IE7 quirks mode)
//            top += document.documentElement.scrollTop;
            top += document.documentElement.scrollTop || document.body.scrollTop;
Combine literacy with curiosity and a whole world of information opens up to you