<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jamie Thompson &#187; Thickbox</title>
	<atom:link href="http://jamiethompson.co.uk/tags/thickbox/feed/" rel="self" type="application/rss+xml" />
	<link>http://jamiethompson.co.uk</link>
	<description>Web Developer</description>
	<lastBuildDate>Thu, 09 Sep 2010 12:16:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Thickbox 3.1 IE7 Positioning Bug</title>
		<link>http://jamiethompson.co.uk/web/2008/03/17/thickbox-31-ie7-positioning-bug/</link>
		<comments>http://jamiethompson.co.uk/web/2008/03/17/thickbox-31-ie7-positioning-bug/#comments</comments>
		<pubDate>Mon, 17 Mar 2008 13:20:26 +0000</pubDate>
		<dc:creator>Jamie Thompson</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Thickbox]]></category>

		<guid isPermaLink="false">http://jamazon.co.uk/web/2008/03/17/thickbox-31-ie7-positioning-bug/</guid>
		<description><![CDATA[
As previously mentioned in this post Thickbox 3.1 is currently broken in many revisions of Internet Explorer 7. Specifically, those revisions who return the substring &#8220;MSIE 6.0&#8243; in the user-agent string.
Update: July 2008
This patch fixes a problem caused when certain installations of IE7 are incorrectly identified as IE6 causing the thickbox window to be positioned [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://s322999261.websitehome.co.uk/wp-content/uploads/2008/07/thickbox.jpg" alt="thickbox" title="thickbox" width="530" height="191" /></p>
<p>As previously mentioned in <a href="http://jamazon.co.uk/web/2008/03/14/jquerybrowserversion-doesnt-recognise-ie7/">this post</a> <a href="http://jquery.com/demo/thickbox/">Thickbox</a> 3.1 is currently broken in many revisions of Internet Explorer 7. Specifically, those revisions who return the substring &#8220;MSIE 6.0&#8243; in the user-agent string.</p>
<h2>Update: July 2008</h2>
<p>This patch fixes a problem caused when certain installations of IE7 are incorrectly identified as IE6 causing the thickbox window to be positioned <strong>partially hidden</strong> in the <strong>top left hand corner</strong> of the viewport . It has become apparent that there are other bugs triggered in other revisions of IE7 which cause another type of miss-positioning with the thickbox window being <strong>centered </strong>correctly but <strong>outside of the viewport</strong>. <strong>This patch doesn&#8217;t fix that</strong></p>
<p>As this is such a widespread problem, and lots of people seem to be having a little difficulty patching their copies of thickbox.js I thought i&#8217;d provide a patched copy here. But first a bit of background for those who are interested in why it&#8217;s broken. The following if statement in the function tb_position is as follows:</p>
<h2>thickbox.js line 284</h2>
<pre class="brush: js">if ( !(jQuery.browser.msie &#038;&#038; jQuery.browser.version < 7)) { // take away IE6
    $("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
}</pre>
<p>The bug is triggered when, in certain revisions of IE7 jQuery.browser.version == 6, resulting in the Thickbox window not receiving the correct CSS positioning. (In IE6, the window receives it position through some clever CSS expressions in thickbox.css)<br />
<span id="more-47"></span><br />
The workaround for all this though is fairly straightforward. You simply need a more accurate way for weeding out IE6... and here it is.</p>
<h2>$.browser.msie6</h2>
<pre class="brush: js">$.browser.msie6 =
    $.browser.msie
    &#038;&#038; /MSIE 6\.0/i.test(window.navigator.userAgent)
    &#038;&#038; !/MSIE 7\.0/i.test(window.navigator.userAgent);</pre>
<p>Once we have this new property defined within the $.browser object we can use it to fix the conditional statement mentioned previously. You can define $.browser.msie6 in thickbox.js (like i have in the patched copies of thickbox below), or patch jQuery itself. Or whatever. It's up to you. After that all that needs to be done is to modify the following line to make use of our new IE6 sniffer:</p>
<h2>thickbox.js line 284</h2>
<pre class="brush: js">if ( !(jQuery.browser.msie6)) { // take away IE6
    $("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
}</pre>
<p>If you don't feel confident patching your own copy of thickbox then feel free to grab a patched copy below. This is thickbox 3.1 with the abovementioned code modifications applied and should simply replace your existing file.</p>
<ul>
<li><a href="/files/js/thickbox.patch.js">thickbox.patch.js</a></li>
<li><a href="/files/js/thickbox.patch.pack.js">thickbox.patch.pack.js</a></li>
</ul>
<p>Let me know if you find this useful</p>
]]></content:encoded>
			<wfw:commentRss>http://jamiethompson.co.uk/web/2008/03/17/thickbox-31-ie7-positioning-bug/feed/</wfw:commentRss>
		<slash:comments>126</slash:comments>
		</item>
	</channel>
</rss>

