Thickbox IE7/IE8 position bug (too low)
jankoch - March 12, 2009 - 03:23
| Project: | Thickbox |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | frjo |
| Status: | reviewed & tested by the community |
Description
I experienced the positioning of thickbox too low in IE7. Looking at the stylesheet (thickbox.css) I simply found this quick hack for IE7:
*+html #TB_window { /* ie7 hack */
position: absolute;
margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
}copying the ie6 hack - block and changing * html to *+html ensures that IE7 interprets the hack as well. Since IE7 uses like 90% of IE6's CSS I was pretty sure this would work - and it did.
I did not have time to test this thoroughly and I am not really a CSS guy, hence the code needs reviewing. However, I still created a patch for those who want to get thickbox working with IE7.
To patch either add the above lines to your thickbox.css or apply thickbox_IE7.patch:
| Attachment | Size |
|---|---|
| thickbox_IE7.patch | 618 bytes |

#1
Thanks! You really helped me out there :)
#2
Can anyone else confirm this?
#3
This fix unfortunately doesn't seem to work. It seems to work if the IE 7 window isn't scrolled at all, but if you scroll down and then click on a 'thickbox' link, the window will open way up top.
#4
I'm seeing this bug with IE 8. Thickbox windows are opening beginning mid-screen and proceeding downwards. They are not centered relative to the page.
To see the problem, don't run you browser window maximized, and make your browser window about 800 pixels high then launch something in a thickbox.
I'm experiencing the bug with Thickbox 6.x-1.5
#5
There is a different (better) way for fixing this in inserting a better browser sniffer in thickbox.js.
It is described here and also works in IE8, if you extend the sniffer to IE8:
http://jamazon.co.uk/web/2008/03/17/thickbox-31-ie7-positioning-bug/
#6
Please try out this patch that extends $.browserextra.msie6 to check so it's not IE8.
If you report that it works I will commit it and release a new version of Thickbox.
#7
Heyho, this fixes it for IE8. Does not seem to break any other browser: tested in FF 3.5, Safari for Windows 4.0.3, IE 6.7,8.