<?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>The Blackbox &#187; jQuery</title>
	<atom:link href="http://www.the-blackbox.co.uk/category/programming/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.the-blackbox.co.uk</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 31 Aug 2010 20:27:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>jQuery &#8211; Basic Thickbox (lightbox, blackbox)</title>
		<link>http://www.the-blackbox.co.uk/programming/jquery-basic-thickbox-lightbox-blackbox/</link>
		<comments>http://www.the-blackbox.co.uk/programming/jquery-basic-thickbox-lightbox-blackbox/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 17:01:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.the-blackbox.co.uk/?p=45</guid>
		<description><![CDATA[This is a very quick run through on how to get a basic jquery thickbox (blackbox) popup working, containing an image, and is based on the official demo page. The actual thickbox demo page has more advanced options available and full documentation &#8211; this is intended for those who don&#8217;t wish to know the full [...]]]></description>
			<content:encoded><![CDATA[<p>This is a very quick run through on how to get a basic jquery thickbox (blackbox) popup working, containing an image, and is based on the <a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fjquery.com%2Fdemo%2Fthickbox%2F&sref=rss">official demo page</a>.  The <a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fjquery.com%2Fdemo%2Fthickbox%2F&sref=rss">actual thickbox demo page</a> has more advanced options available and full documentation &#8211; this is intended for those who don&#8217;t wish to know the full ins and outs of the functionality, but just want it working! <img src='http://www.the-blackbox.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So let&#8217;s get started&#8230;.</p>
<p>The first thing to do is <a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fdocs.jquery.com%2FDownloading_jQuery%23Current_Release&sref=rss">download the latest version of jquery</a>.</p>
<p>Next grab:</p>
<ul>
<li><a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fjquery.com%2Fdemo%2Fthickbox%2Fthickbox-code%2Fthickbox.js&sref=rss">thickbox.js</a> (<a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fjquery.com%2Fdemo%2Fthickbox%2Fthickbox-code%2Fthickbox-compressed.js&sref=rss">thickbox-compressed.js</a>)</li>
<li><a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fjquery.com%2Fdemo%2Fthickbox%2Fthickbox-code%2Fthickbox.css&sref=rss">thickbox.css</a></li>
<li><a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fjquery.com%2Fdemo%2Fthickbox%2Fimages%2FloadingAnimation.gif&sref=rss">loadingAnimation.gif</a></li>
</ul>
<p>First, make sure the page you are trying to use the Thickbox on, has a valid <a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fwww.alistapart.com%2Farticles%2Fdoctype%2F&sref=rss">DTD</a> &#8211; it will not function correctly if you don&#8217;t.  I as a rule, use the Strict DTD.</p>
<p>Next we include the javascript files we have downloaded, and the css file &#8211; taking note to replace the path and filenames if you downloaded the compressed versions:</p>
<blockquote><p>
&lt;input type=&#8221;radio&#8221; name=&#8221;payRemainingBalance&#8221; value=&#8221;true&#8221; checked=&#8221;checked&#8221;/&gt;<br />
&lt;script type=&#8221;text/javascript&#8221; src=&#8221;<strong>javascript/jquery.1.6.4.pack.js</strong>&#8220;&gt;&lt;/script&gt;<br />
&lt;script type=&#8221;text/javascript&#8221; src=&#8221;<strong>javascript/thickbox-compressed.js</strong>&#8220;&gt;&lt;/script&gt;<br />
&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;<strong>css/thickbox.css</strong>&#8221; type=&#8221;text/css&#8221; media=&#8221;screen&#8221; /&gt;
</p></blockquote>
<p>Now that we have those included, we need to quickly edit <strong>thickbox.css</strong>, and tell it where to find the <strong>loadingAnimation.gif</strong> that we downloaded earlier.  By default it looks for <strong>images/loadingAnimation.gif</strong>, so if this is where you&#8217;ve put it, you can ignore this step.</p>
<p>We should now be good to go, to try your thickbox out &#8211; there are a few ways to do this,the most common being from a text or image link, opening up the thickbox to contain an image, so we&#8217;ll use that as our example.</p>
<p>Text link:</p>
<blockquote><p>
&lt;a href=&#8221;path-to-your/image.jpg&#8221; class=&#8221;thickbox&#8221;&gt;Show Image&lt;/a&gt;
</p></blockquote>
<p>Image link:</p>
<blockquote><p>
&lt;a href=&#8221;path-to-your/image.jpg&#8221; class=&#8221;thickbox&#8221;&gt;&lt;img src=&#8221;path-to-your/link-image.jpg&#8221; /&gt;&lt;/a&gt;
</p></blockquote>
<p>The <strong>class=&#8221;thickbox&#8221;</strong> is the important bit, so make sure you&#8217;ve got that in there!</p>
<p>This should give you a working, (very) basic example of the thickbox.  Once you&#8217;re happy with that, look at the rest of the examples, and you will find you can use it for various things, not just for showing pictures!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.the-blackbox.co.uk/programming/jquery-basic-thickbox-lightbox-blackbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery &#8211; Show and Hide Input Box &amp; Highlighting</title>
		<link>http://www.the-blackbox.co.uk/programming/jquery-show-and-hide-input-box-highlighting/</link>
		<comments>http://www.the-blackbox.co.uk/programming/jquery-show-and-hide-input-box-highlighting/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 12:50:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.the-blackbox.co.uk/?p=22</guid>
		<description><![CDATA[As part of a recent project, I had to make a payment page clear, user friendly and intuative.  One of the key things was to only display fields when certain options were selected &#8211; in this case, when a radio button had a certain value. &#60;input type=&#8221;radio&#8221; name=&#8221;payRemainingBalance&#8221; value=&#8221;true&#8221; checked=&#8221;checked&#8221;/&#62; the full amount ($amountDue). &#60;input [...]]]></description>
			<content:encoded><![CDATA[<p>As part of a recent project, I had to make a payment page clear, user friendly and intuative.  One of the key things was to only display fields when certain options were selected &#8211; in this case, when a radio button had a certain value.</p>
<blockquote><p>&lt;input type=&#8221;radio&#8221; name=&#8221;payRemainingBalance&#8221; value=&#8221;true&#8221; checked=&#8221;checked&#8221;/&gt; the full amount ($amountDue).<br />
&lt;input type=&#8221;radio&#8221; name=&#8221;payRemainingBalance&#8221; value=&#8221;false&#8221; /&gt; another amount. (Enter the amount you wish to pay in the field below)&lt;/td&gt;<br />
&lt;div id=&#8221;anotherAmount&#8221;&gt;<br />
Another Amount: &lt;input type=&#8221;text&#8221; name=&#8221;paymentAmount&#8221; id=&#8221;paymentAmount&#8221; maxlength=&#8221;8&#8243; /&gt;<br />
&lt;/div&gt;</p></blockquote>
<p>Using jQuery, this is very simple to do:</p>
<blockquote><p>&lt;script type=&#8221;text/javascript&#8221;&gt;</p>
<p>$(document).ready(function(){<br />
$(&#8220;input[@name='payFullAmount']&#8220;).click(function(){<br />
$(&#8220;input[@name='payFullAmount']:checked&#8221;).val() == &#8216;false&#8217; ? $(&#8220;#anotherAmount&#8221;).show() : $(&#8220;#anotherAmount&#8221;).hide();<br />
});<br />
});</p>
<p>&lt;/script&gt;</p></blockquote>
<p>As we don&#8217;t have an id on the radio button, we use the name of the input as the identifier, and a simple one liner to establish what the new value of the radio button is.</p>
<p>Due to the focus being on making it clear what is happening, it could be quite easy when you select the radio button, to miss what has changed on the page (a new input box appearing), so I decided to try and highlight the newly displayed input box by fading the background colour of the input box, in and out.  In order to do this in jQuery, you need the <a title="jQuery Color Plugin" href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fplugins.jquery.com%2Fproject%2Fcolor&sref=rss" target="_blank">jQuery Color plugin</a>.</p>
<blockquote><p>&lt;script type=&#8221;text/javascript&#8221;&gt;</p>
<p>$(document).ready(function(){<br />
$(&#8220;input[@name='payFullAmount']&#8220;).click(function(){<br />
$(&#8220;input[@name='payFullAmount']:checked&#8221;).val() == &#8216;false&#8217; ? $(&#8220;#anotherAmount&#8221;).show() : $(&#8220;#anotherAmount&#8221;).hide();</p>
<p>if ($(&#8220;input[@name='payFullAmount']:checked&#8221;).val() == &#8216;false&#8217;) {<br />
$(&#8220;#paymentAmount&#8221;).animate({ backgroundColor: &#8220;#EFB559&#8243; }, 1000).animate({ backgroundColor: &#8220;#FFFFFF&#8221; }, 1000).animate({ backgroundColor: &#8220;#EFB559&#8243; }, 1000).animate({ backgroundColor: &#8220;#FFFFFF&#8221; }, 1000);<br />
}</p>
<p>});<br />
});</p>
<p>&lt;/script&gt;</p></blockquote>
<p>Our starting background colour is #FFFFFF, we fade to #EFB559 in 1 second, back to #FFFFFF in 1 second, to #EFB559 in 1 second, and finally back to #FFFFFF in 1 second.  This gives the effect of highlighting the field in an orange colour twice, hopefullyhelping the user notice what has changed on the page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.the-blackbox.co.uk/programming/jquery-show-and-hide-input-box-highlighting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
