<?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/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>Cyberward.net &#187; javascript</title>
	<atom:link href="http://www.cyberward.net/blog/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cyberward.net/blog</link>
	<description>The Drive Failures and Shutter Clicks of Christopher Ward</description>
	<lastBuildDate>Wed, 21 Jul 2010 12:00:15 +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>iPad Ready and bgStretcher2 Update</title>
		<link>http://www.cyberward.net/blog/2010/04/ipad-ready-and-bgstretcher2-update/</link>
		<comments>http://www.cyberward.net/blog/2010/04/ipad-ready-and-bgstretcher2-update/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 10:04:55 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=1936</guid>
		<description><![CDATA[
I took this picture, from my iPod, of an iPad showing off my portfolio. It looks amazing. The images are actually sized perfectly for this device. But there was something weird. All the images in the night album, and the occasional other image won&#8217;t show. I get the blue image not found icon. Very weird. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cyberward.net/blog/wp-content/uploads/iPad-CWW.jpg"><img class="alignnone size-full wp-image-1937" title="iPad-CWW" src="http://www.cyberward.net/blog/wp-content/uploads/iPad-CWW.jpg" alt="" width="500" height="394" /></a></p>
<p>I took this picture, from my iPod, of an iPad showing off my <a href="http://www.cyberward.net/photography/">portfolio</a>. It looks amazing. The images are actually sized perfectly for this device. But there was something weird. All the images in the night album, and the occasional other image won&#8217;t show. I get the blue image not found icon. Very weird. I wonder if they are exported with some weird settings. Not sure how that happened.</p>
<p>I was also able to confuse the javascript by pressing on the album and next/previous buttons. I will have to take a look at that. As noted yesterday, it doesn&#8217;t work well on the iPhone either. I also checked Kelby&#8217;s site again, and it looks great too, just not on the iPhone. I am wondering how that device reports it&#8217;s screen size. I might just need to look for that browser and then display presized smaller images.</p>
<p>If you want to get a rough idea of what your site would look like on the iPhone, check out<a href="http://ipadpeek.com/"> iPad Peek</a>. It doesn&#8217;t show the broken images like the iPad did, but it will give you a sense of size and how your content will fit. Just enter your site in the address bar at the top.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2010/04/ipad-ready-and-bgstretcher2-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Are you iPad Ready? (No flash allowed)</title>
		<link>http://www.cyberward.net/blog/2010/04/are-you-ipad-ready-no-flash-allowed/</link>
		<comments>http://www.cyberward.net/blog/2010/04/are-you-ipad-ready-no-flash-allowed/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 20:17:29 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=1931</guid>
		<description><![CDATA[
Are you a photographer with a flash site? Do you know that the iPad, just like the iPhone, will not display flash content? What&#8217;s a photographer to do? Scott Kelby looked at this earlier today.
When Kelby first put up his flash portfolio, I decided to create a javascript only portfolio site to do the same [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cyberward.net/blog/wp-content/uploads/screen.jpg"><img class="alignnone size-full wp-image-1777" title="Gallery Slideshow Screen Shot" src="http://www.cyberward.net/blog/wp-content/uploads/screen.jpg" alt="" width="500" height="396" /></a></p>
<p>Are you a photographer with a flash site? Do you know that the iPad, just like the iPhone, will not display flash content? What&#8217;s a photographer to do? Scott Kelby looked at this <a href="http://www.scottkelby.com/blog/2010/archives/9503">earlier today</a>.</p>
<p>When Kelby first put up his flash portfolio, I decided to create a javascript only portfolio site to do the same thing. See my portfolio <a href="http://cyberward.net/photography">here</a>, and my post <a href="http://www.cyberward.net/blog/2010/02/full-screen-slideshow-in-javascript/">here</a>.</p>
<p>I think my code is successful, to a certain extent. It works great on the desktop, but doesn&#8217;t work as well on the iPhone, and I don&#8217;t yet know on the iPad. Need to try that out. Anyone that wants to comment about that, please do.</p>
<p>I think that my issue on the iPhone is the size of the images. I think they need to be smaller to save on bandwidth, and prevent the phone&#8217;s browser from having to scale the images so much. That may be the issue on Kelby&#8217;s site too, because his new non flash site didn&#8217;t work well on the iPhone either. His new portfolio is also a jQuery javascript site done by RC. It was too slow to be useable on my phone. I wonder if image size is the issue there to. Now his site was optimized for the iPad, not the iPhone, but I want mine to work on both. I will need to do some more testing with smaller images to see.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2010/04/are-you-ipad-ready-no-flash-allowed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Full Screen Slideshow in Javascript</title>
		<link>http://www.cyberward.net/blog/2010/02/full-screen-slideshow-in-javascript/</link>
		<comments>http://www.cyberward.net/blog/2010/02/full-screen-slideshow-in-javascript/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 11:30:54 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[photo gallery]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=1760</guid>
		<description><![CDATA[
So I now have a full screen slideshow in Javascript, without using flash, and I wanted to tell you how I did it, and how you can do it too. I will talk a bit about Javascript here, but you will be able to download the jQuery plugin I have without needing to know much, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cyberward.net/photography/"><img class="alignnone size-full wp-image-1777" title="Gallery Slideshow Screen Shot" src="http://www.cyberward.net/blog/wp-content/uploads/screen.jpg" alt="" width="500" height="396" /></a></p>
<p>So I now have a full screen <a href="http://cyberward.net/photography/">slideshow</a> in Javascript, without using flash, and I wanted to tell you how I did it, and how you can do it too. I will talk a bit about Javascript here, but you will be able to download the jQuery plugin I have without needing to know much, if all you want is to implement the gallery.</p>
<p>I got the idea for this plugin after looking at a flash version of Scott Kelby&#8217;s <a href="http://www.scottkelby.com/portfolio/">portfolio</a>. I just wanted to give it a try in Javascript.</p>
<p>I have created a <a href="http://www.cyberward.net/blog/code/bgstretcher2/">permanent page</a> for bgStretcher2, so it is easier to find from the side bar, so look <a href="http://www.cyberward.net/blog/code/bgstretcher2/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2010/02/full-screen-slideshow-in-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>BuzzBoost your Feedburner Feed via Javascript</title>
		<link>http://www.cyberward.net/blog/2009/04/buzzboost-your-feedburner-feed-via-javascript/</link>
		<comments>http://www.cyberward.net/blog/2009/04/buzzboost-your-feedburner-feed-via-javascript/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 01:47:56 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[feedburner]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[rss]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=1036</guid>
		<description><![CDATA[Well, it was pointed out to me that there was an easier way to get RSS feeds onto your site. Feedburner. Guess what. It is also a Google product. Sheesh! Basicly, you need to get your feed registered with Feedburner. Then you can use their BuzzBoost to create a piece of Javascript that will get [...]]]></description>
			<content:encoded><![CDATA[<p>Well, it was pointed out to me that there was an easier way to get RSS feeds onto your site. Feedburner. Guess what. It is also a Google product. Sheesh! Basicly, you need to get your feed registered with Feedburner. Then you can use their BuzzBoost to create a piece of Javascript that will get your feed for you. It is pretty similar to what the GoogleApi is doing that I talked about earlier. The difference here is that Feedburner has a control panel where you set up how¬† your feed looks. No need to figure out any Javascript at all.</p>
<p>So this is my feed via <a href="http://www.cyberward.net/blog/feed/">Wordpress</a>.</p>
<p>This is my feed via <a href="http://feeds2.feedburner.com/cyberward">Feedburner</a>.</p>
<p>This is a snipit of my feed from the BuzzBoost.</p>
<p><script src="http://feeds2.feedburner.com/cyberward?format=sigpro" type="text/javascript" ></script><noscript>
<p>Subscribe to RSS headline updates from: <a href="http://feeds2.feedburner.com/cyberward"></a><br/>Powered by FeedBurner</p>
<p> </noscript><br />
<br/></p>
<p>And this is the code that was generated that I pasted in. Pretty simple. I had a hard time getting feedburner to recognize my feed, but I am not sure that is feedburners fault. Wordpress appears to take a really long time to respond with the feed.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1036code2'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10362"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p1036code2"><pre class="html" style="font-family:monospace;">&lt;script src=&quot;http://feeds2.feedburner.com/cyberward?format=sigpro&quot; type=&quot;text/javascript&quot; &gt;&lt;/script&gt;&lt;noscript&gt;&lt;p&gt;Subscribe to RSS headline updates from: &lt;a href=&quot;http://feeds2.feedburner.com/cyberward&quot;&gt;&lt;/a&gt;&lt;br/&gt;Powered by FeedBurner&lt;/p&gt; &lt;/noscript&gt;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2009/04/buzzboost-your-feedburner-feed-via-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RSS Feeds via Javascript</title>
		<link>http://www.cyberward.net/blog/2009/04/rss-feeds-via-javascript/</link>
		<comments>http://www.cyberward.net/blog/2009/04/rss-feeds-via-javascript/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 18:25:58 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[rss]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=1015</guid>
		<description><![CDATA[I set about recently to try to get a RSS feed parsed using only Javascript. Not as easy as I had thought it would be. I had figured that there would be several Javascript library&#8217;s around, and I thought for sure that someone would have a jQuery plugin for it. Well, I did find jFeed, [...]]]></description>
			<content:encoded><![CDATA[<p>I set about recently to try to get a RSS feed parsed using only Javascript. Not as easy as I had thought it would be. I had figured that there would be several Javascript library&#8217;s around, and I thought for sure that someone would have a jQuery plugin for it. Well, I did find <a href="http://www.hovinne.com/blog/index.php/2007/07/15/132-jfeed-jquery-rss-atom-feed-parser-plugin">jFeed</a>, but it suffers from a rather large issue. It can&#8217;t access sites from a different domain from where it is running. This is really a Javascript security feature. I did a simple AJAX test, and sure enough, Javascript stops us from directly accessing another domain (to prevent cross site scripting attacks).</p>
<p>How do you get around this issue? Well, a php based proxy is one solution. You call via AJAX, this php file that then makes the request to the real feed, and sends it back. That didn&#8217;t seem like a simple or elegant enough solution.</p>
<p>I found <a href="http://www.feedforall.com/free-php-script.htm">RssToHtml</a>, which is a PHP script that you can use the parse the RSS feed. Using this, you can even use an server side¬†include to get the feed. This¬†didn&#8217;t work on my machine¬†that would only¬†run cgi scripts from the include.¬†</p>
<p>I had just about given up when I stumbled upon the <a href="http://code.google.com/apis/ajaxfeeds/documentation/#FEEDCONTROL">Google AJAX Feed Api</a>. Google to the rescue again.<br />
<span id="more-1015"></span></p>
<blockquote><p>Note: for these examples, the simplest thing was to include an image example, not a running example inline. The Wordpress editor (even in html mode) keeps sticking in formatting and killing the javascript. There are links to example pages.</p></blockquote>
<p>The first thing I tried was a <a href="http://www.google.com/uds/solutions/wizards/dynamicfeed.html">wizard</a> that created feed code for you. It presents a cool little AJAX box that can rotate through a feed list. This is what it looks like for one feed (see <a href="http://www.cyberward.net/examples/googleApi/googleDynamic1.html">example</a> page also) :</p>
<p><a href="http://www.cyberward.net/examples/googleApi/googleDynamic1.html"><img class="alignnone size-full wp-image-1025" title="singlefeed" src="http://www.cyberward.net/blog/wp-content/uploads/singlefeed.png" alt="singlefeed" width="372" height="176" /></a></p>
<p>This is what it looks like for multiple feeds (see <a href="http://www.cyberward.net/examples/googleApi/googleDynamic2.html">example</a> page also) :</p>
<p><a href="http://www.cyberward.net/examples/googleApi/googleDynamic2.html"><img class="alignnone size-full wp-image-1026" title="multiplefeed" src="http://www.cyberward.net/blog/wp-content/uploads/multiplefeed.png" alt="multiplefeed" width="372" height="315" /></a></p>
<p>But this still wasn&#8217;t quite what I wanted. It was a little too flashy. I really just wanted a list of posts, with links to them. I then found the API page (that I mentioned above) and some more basic examples.</p>
<p>This is what I got (see <a href="http://www.cyberward.net/examples/googleApi/googleApi.html">example</a> page also) :</p>
<p><a href="http://www.cyberward.net/examples/googleApi/googleApi.html"><img class="alignnone size-full wp-image-1027" title="googleapi" src="http://www.cyberward.net/blog/wp-content/uploads/googleapi.png" alt="googleapi" width="216" height="86" /></a></p>
<p>There we go. That is what I was looking for. Ok, so what do you have to do to get this same result? First you should get a <a href="http://code.google.com/apis/ajaxsearch/key.html">google api key</a>. If you are grabbing code from me, don&#8217;t use my google code. Get your own, or use &#8220;key=notsupplied-wizard&#8221; instead.</p>
<p>You really need three pieces. You need to point to the google search API:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1015code6'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10156"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p1015code6"><pre class="html" style="font-family:monospace;">&lt;script src=&quot;http://www.google.com/jsapi?key=notsupplied-wizard&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</pre></td></tr></table></div>

<p>Then you need the javascript that will do the work. I will explain it in a minute.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1015code7'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10157"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code" id="p1015code7"><pre class="html" style="font-family:monospace;">&lt;script type=&quot;text/javascript&quot;&gt;
  google.load(&quot;feeds&quot;, &quot;1&quot;);
  function initialize() {
    var feed = new google.feeds.Feed(&quot;http://www.cyberward.net/blog/feed/&quot;);
    feed.load(function(result) {
      if (!result.error) {
        var container = document.getElementById(&quot;feed&quot;);
        for (var i = 0; i &lt; result.feed.entries.length; i++) {
          var entry = result.feed.entries[i];
          var div = document.createElement(&quot;div&quot;);
          var anchor = document.createElement(&quot;a&quot;);
          anchor.appendChild(document.createTextNode(entry.title));
          anchor.setAttribute('href', entry.link);
		  div.appendChild(anchor);
          container.appendChild(div);
        }
      }
    });
  }
  google.setOnLoadCallback(initialize);
&lt;/script&gt;</pre></td></tr></table></div>

<p>That javascript can be included in a head statement. It doesn&#8217;t need to be inline with your presentation. Last, you need a DIV that the feed will show up in.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1015code8'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10158"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p1015code8"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;feed&quot;&gt;&lt;/div&gt;</pre></td></tr></table></div>

<p>So you can see where I gave my feed url in the javascript. Change that to whatever you want the feed to be. The rest of the javascript is used to create some code on the fly. It is added to the div &#8220;feed&#8221;. That can be any div you want. Just change the &#8220;document.getElementById(&#8220;feed&#8221;);&#8221; code to what ever your div is called instead of &#8220;feed&#8221;.</p>
<p>The basic example on the site does not show links. I had to build that. The result that comes back is a json object that contains info about the feed. I discovered that for every &#8220;entry&#8221; there was not only a &#8220;title&#8221; but a &#8220;link&#8221;. I used the &#8220;link&#8221; property to build an anchor tag to wrap the title. Now when the list is presented, a viewer can click on the text and go to the post. If you want to present more info, &#8220;publishedDate&#8221; and &#8220;content&#8221; are two other attributes you may want to use.</p>
<p>It works pretty well. Google caches the feeds too. Not sure how that is done, or how fast it is refreshed, but it sure is darn fast. I like it. Give it a try.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2009/04/rss-feeds-via-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use Thickbox</title>
		<link>http://www.cyberward.net/blog/2009/04/how-to-use-thickbox/</link>
		<comments>http://www.cyberward.net/blog/2009/04/how-to-use-thickbox/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 17:49:49 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[photo gallery]]></category>
		<category><![CDATA[thickbox]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=980</guid>
		<description><![CDATA[I have had a lot of hits on my How to use Lytebox post, and I thought I might continue it as a series and do something on another of the light box clones. It also looks like lytebox¬†has been discontinued by the author. I have started to use Thickbox.¬†Why you ask? It uses jQuery, [...]]]></description>
			<content:encoded><![CDATA[<p>I have had a lot of hits on my <a href="http://www.cyberward.net/blog/2009/02/how-to-use-lytebox/">How to use Lytebox</a> post, and I thought I might continue it as a series and do something on another of the light box clones. It also looks like lytebox¬†has been discontinued by the author. I have started to use <a href="http://jquery.com/demo/thickbox/">Thickbox</a>.¬†Why you ask? It uses <a href="http://jquery.com/">jQuery</a>, and I am starting to really like that library. One of the things that drew me to lytebox was that it had no dependencies. But now, more sites require javascript anyway, and my library of choice is jQuery. So, if I am using jQuery, why not the Thickbox plugin?</p>
<p>If you are not sure about this library, check out <a href="http://planetozh.com/projects/lightbox-clones/">this matrix</a> that lists just about every light box type javascript library around.</p>
<p><span id="more-980"></span></p>
<h3>Setting up¬†Thickbox</h3>
<p>The <a href="http://jquery.com/demo/thickbox/">thickbox site</a> has great examples too. It is not hard to set up. Head over to the Thickbox site and grab the files. What you need to get are the thickbox.js file, the thickbox.css file, the loadingAnimation.gif, and the macFFBgHack.png. More on the images in a minute.</p>
<p>Don&#8217;t forget, this is a plugin, or aditional library that builds on jQuery, so you will need to <a href="http://docs.jquery.com/Downloading_jQuery">download¬†jQuery</a> too. You will only need one file: jQuery.js. For these¬†examples I am not using the compressed versions, but you could. Both jQuery and Thickbox offer compressed versions of their javascript libraries. They might be worth using in a production environment, but I will use the fully spaced files here.</p>
<p>Ok, first up, I like to have a bit of structure to my web sites. I like to have js, css,¬†images, and pictures folders. You don&#8217;t have to, but this is what I do. I put my javascript into the js folder. I put style sheets into css, icons and graphics for the site into images, and photographs into the pictures folder. So for this example, that is where¬†I put the files.¬†</p>
<pre>/examples/thickbox/js/jquery.js
                 /js/thickbox.js
                 /css/thickbox.js
                 /images/loadingAnimation.gif
                 /images/macFFBgHack.png</pre>
<h3>A few little tweaks</h3>
<p>If you put all of the files into /examples/thickbox/, and not into the structure like we have, you wouldn&#8217;t need to do this step, but if you did, we need to edit a couple of thickbox files to let them know what we did.</p>
<p>You can edit files in any number of ways. If you are on a web server running linux, you might want to try nano. It is pretty easy to use, and gives you some ctrl key combinations at the bottom for thigs like saving and searching.</p>
<p>To edit the index html file in nano type:</p>
<pre>nano -w index.html</pre>
<p>You can move around using the cursor keys, and the terminal will scroll for you. When you want to exit and save, press ctrl-x.</p>
<p>First is the /js/thickbox.js file. We need to modify were the loading animation is located. Change that line to:</p>
<pre>var tb_pathToImage = "images/loadingAnimation.gif";</pre>
<p>This line is inserted into generated html, so the path is relative to the html page created.</p>
<p>Then we need to look at the /css/thickbox.cc file. We need to navigate down through that file and find the .TB_overlayMacFFBGHack class. Change that to:</p>
<pre>.TB_overlayMacFFBGHack {background: url(../images/macFFBgHack.png) repeat;}</pre>
<p>What are these files for? The loading animation is a little bar that shows up inbetween when you click on the image, and the larger one is ready. The overlay image is to help firefox on Mac&#8217;s provide the screen dimming over flash.</p>
<h3>Including our files.</h3>
<p>To get our files &#8216;included&#8217; into a html document, we need to put some lines into the head of the document, like this:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p980code15'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p98015"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p980code15"><pre class="html" style="font-family:monospace;">&lt;script src=&quot;js/jquery.js&quot; type=&quot;text/javascript&quot;&gt;&lt;!--mce:0--&gt;&lt;/script&gt;
&lt;script src=&quot;js/thickbox.js&quot; type=&quot;text/javascript&quot;&gt;&lt;!--mce:1--&gt;&lt;/script&gt;</pre></td></tr></table></div>

<p>That&#8217;s all there is to it. The two script tags insert the javascript, and the link tag inserts the stylesheet.</p>
<h3>Apply the effect</h3>
<p>Thickbox uses the jQuery library. This means that it is all about selectors. That usually means that we use css class names in our javascript to identify elements on a page. Thickbox uses the &#8220;thickbox&#8221; class to identify what images to apply this effect to.</p>
<p>Here is a line of html that displays a thumbnail, and when you click on it, it takes you to a different page and displays it full screen.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p980code16'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p98016"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p980code16"><pre class="html" style="font-family:monospace;">&lt;a title=&quot;Montana Cabin&quot; href=&quot;pictures/Montana Cabin.jpg&quot;&gt;
&lt;img src=&quot;pictures/Montana Cabin thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;</pre></td></tr></table></div>

<p>Here is a line of html that displays a thumbnail, and when you click on it, it uses the thickbox javascript to display the light box type effect.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p980code17'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p98017"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p980code17"><pre class="html" style="font-family:monospace;">&lt;a class=&quot;thickbox&quot; title=&quot;Montana Cabin&quot; href=&quot;pictures/Montana Cabin.jpg&quot;&gt;&lt;img src=&quot;pictures/Montana Cabin thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;</pre></td></tr></table></div>

<p>Not much different is there? The only difference is the class=&#8221;thickbox&#8221;. I think that is pretty cool. How about linking several images together so that you can use next and previous buttons to link them? You just need to add a rel=&#8221;xxx&#8221; where xxx is the name of the gallery. As long as this text is the same for each image you want linked together, it can be anything.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p980code18'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p98018"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p980code18"><pre class="html" style="font-family:monospace;">&lt;a class=&quot;thickbox&quot; title=&quot;Montana Cabin&quot; rel=&quot;gallery2&quot; href=&quot;pictures/Montana Cabin.jpg&quot;&gt;&lt;img src=&quot;pictures/Montana Cabin thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;a class=&quot;thickbox&quot; title=&quot;Montana Road&quot; rel=&quot;gallery2&quot; href=&quot;pictures/Montana Road.jpg&quot;&gt;&lt;img src=&quot;pictures/Montana Road thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;</pre></td></tr></table></div>

<h3>The full example</h3>
<p>What I show now is a full example of using this to create a gallery. A very simple one. Not going to win any style awards, but it will do. There are 3 versions of the index.html file here. One <a href="http://www.cyberward.net/examples/thickbox/index.html">without the thickbox</a> effect at all (index.html), one <a href="http://www.cyberward.net/examples/thickbox/index2.html">with the thickbox</a> effect (index2.html), and one with <a href="http://www.cyberward.net/examples/thickbox/index3.html">thickbox using gallerys</a>¬†(index3.html). To make this work I have also added another css file: /css/gallery.css.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p980code19'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p98019"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code" id="p980code19"><pre class="html" style="font-family:monospace;">&nbsp;
  &lt;script src=&quot;js/jquery.js&quot; type=&quot;text/javascript&quot;&gt;&lt;!--mce:2--&gt;&lt;/script&gt;
  &lt;script src=&quot;js/thickbox.js&quot; type=&quot;text/javascript&quot;&gt;&lt;!--mce:3--&gt;&lt;/script&gt;
&lt;h1&gt;Thickbox Example Gallery&lt;/h1&gt;
&lt;h3&gt;
    &lt;a href=&quot;index.html&quot;&gt;No Thickbox&lt;/a&gt;
    &lt;a href=&quot;index2.html&quot;&gt;Using Thickbox&lt;/a&gt;
    &lt;span&gt;Thickbox with Galleries&lt;/span&gt;&lt;/h3&gt;
&lt;a class=&quot;thickbox&quot; title=&quot;Erie Night&quot; rel=&quot;gallery1&quot; href=&quot;pictures/Erie Night.jpg&quot;&gt;&lt;img src=&quot;pictures/Erie Night thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
  &lt;a class=&quot;thickbox&quot; title=&quot;Field of Grass&quot; rel=&quot;gallery1&quot; href=&quot;pictures/Field of Grass.jpg&quot;&gt;&lt;img src=&quot;pictures/Field of Grass thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
  &lt;a class=&quot;thickbox&quot; title=&quot;Gentle Evening&quot; rel=&quot;gallery1&quot; href=&quot;pictures/Gentle Evening.jpg&quot;&gt;&lt;img src=&quot;pictures/Gentle Evening thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
  &lt;a class=&quot;thickbox&quot; title=&quot;Reflected Cloud&quot; rel=&quot;gallery1&quot; href=&quot;pictures/Reflected Cloud.jpg&quot;&gt;&lt;img src=&quot;pictures/Reflected Cloud thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&nbsp;
  &lt;a class=&quot;thickbox&quot; title=&quot;Montana Cabin&quot; rel=&quot;gallery2&quot; href=&quot;pictures/Montana Cabin.jpg&quot;&gt;&lt;img src=&quot;pictures/Montana Cabin thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
  &lt;a class=&quot;thickbox&quot; title=&quot;Montana Road&quot; rel=&quot;gallery2&quot; href=&quot;pictures/Montana Road.jpg&quot;&gt;&lt;img src=&quot;pictures/Montana Road thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
  &lt;a class=&quot;thickbox&quot; title=&quot;Montana Sunset&quot; rel=&quot;gallery2&quot; href=&quot;pictures/Montana Sunset.jpg&quot;&gt;&lt;img src=&quot;pictures/Montana Sunset thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
  &lt;a class=&quot;thickbox&quot; title=&quot;Spoon and Cherry&quot; rel=&quot;gallery2&quot; href=&quot;pictures/Spoon and Cherry.jpg&quot;&gt;&lt;img src=&quot;pictures/Spoon and Cherry thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;h3&gt;&lt;a href=&quot;http://www.cyberward.net/blog/2009/04/how-to-use-thickbox/&quot;&gt;Cyberward blog post on Thickbox&lt;/a&gt;&lt;/h3&gt;</pre></td></tr></table></div>


<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p980code20'); return false;">View Code</a> CSS</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p98020"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code" id="p980code20"><pre class="css" style="font-family:monospace;">body <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
h1<span style="color: #00AA00;">,</span> h3<span style="color: #00AA00;">,</span> h3 a<span style="color: #00AA00;">,</span> span <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
img <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">solid</span> <span style="color: #933;">1px</span> <span style="color: #993333;">gray</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
img<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">solid</span> <span style="color: #933;">1px</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
        <span style="color: #808080; font-style: italic;">/* doesn't work in ie */</span>
<span style="color: #00AA00;">&#125;</span>
a img <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>There you have it. A pretty simple gallery. Fell free to copy it. You will just need to download the files from jQuery and Thickbox, and get your own images. Have fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2009/04/how-to-use-thickbox/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Moving Pictures via Javascript</title>
		<link>http://www.cyberward.net/blog/2009/01/moving-pictures-via-javascript/</link>
		<comments>http://www.cyberward.net/blog/2009/01/moving-pictures-via-javascript/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 13:00:47 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[collage]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[lytebox]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=394</guid>
		<description><![CDATA[Ok, I had promised to let anyone know that happened to be reading before Christmas, that I would talk about the collage script that I am using on the Christoper Ward Photography site. I am using the lytebox script when you click on an image, but the collage image that moves the pictures around the [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, I had promised to let anyone know that happened to be reading before Christmas, that I would talk about the collage script that I am using on the <a href="http://christopherwardphotography.com">Christoper Ward Photography</a> site. I am using the <a href="http://www.dolem.com/lytebox/">lytebox</a> script when you click on an image, but the collage image that moves the pictures around the screen is all mine.</p>
<p>You can get the html source from that page. Here is the Javascript and the CSS files that are used. You can use this code, but please leave the Javascript comment header with my name on it.</p>
<pre lang="Javascript" name="collage.js">
/*
	collage javascript

	You are free to use this script provided you include this header

	Created by Chris Ward
	veggie2u@cyberward.net

http://www.cyberward.net/blog/

*/

function Collage(pName) {
	this.name = pName;
	this.state = "closed";
	Collage.list[Collage.quantity] = this;
	Collage.quantity += 1;
}

Collage.prototype.open = function() {
	Collage.closeAll();
	for( i=0; i < this.endPoints.length; i++ ) {
		$image = this.name+'img'+(i+1);
		new Effect.Move($($image), { x:this.endPoints[i][0], y:this.endPoints[i][1], mode: 'absolute' });
	}
	this.state = "open";
}

Collage.prototype.close = function() {
	for( i=0; i < this.endPoints.length; i++ ) {
		$image = this.name+'img'+(i+1);
		new Effect.Move($($image), { x:this.startPoint[0], y:this.startPoint[1], mode: 'absolute' });
	}
	this.state = "closed";
}

Collage.prototype.swap = function() {
	if( this.state == "closed" ) {
		this.open();
	} else {
		this.close();
	}
}

Collage.closeAll = function() {
	for( i=0; i < Collage.quantity; i++ ) {
		var $aCollage = Collage.list[i];
		if( $aCollage.state == "open" ) {
			$aCollage.close();
		}
	}
}

function doOnLoad() {
	$$('img.collageImg').each(function(s) {
		s.show();
	});
	collage1.swap();
}

Collage.quantity = 0;
Collage.list = new Array();

var collage1 = new Collage("g1");
collage1.endPoints = [ [280, 80], [300, 180], [400,100], [580,120], [500,200], [280,400], [340,320], [540,290], [480,380], [620, 440] ];
collage1.startPoint = [4, 60];

var collage2 = new Collage("g2");
collage2.endPoints = [ [220, 100], [360, 120], [280,220], [300,390], [380,300], [580,100], [500,180], [470,420], [560,330], [660, 420] ];
collage2.startPoint = [4, 180];

var collage3 = new Collage("g3");
collage3.endPoints = [ [280, 80], [240, 230], [400,100], [460,180], [280,400], [340,320], [540,290], [600, 400], [580, 130], [480,380] ];
collage3.startPoint = [4, 300];

var collage4 = new Collage("g4");
collage4.endPoints = [ [280, 80], [300, 230], [400,100], [540,120], [580,200], [340,400], [280,320], [480,290], [540,380], [700, 110], [650, 350] ];
collage4.startPoint = [4, 420];
</pre>
<pre lang="css" name="collage.css">
body {
	background: black;
	margin:0;
	padding:0;
	height:100%;
}

#albums {
	position:absolute;
	top:10px;
	left:20px;
}

#about {
	position:absolute;
	top:530px;
	left:10px;
}

#about img {
	border:0;
}
#about a {
	text-decoration:none;
}

#title {
	position:absolute;
	top:10px;
	left:220px;
}

#collages {
	background-image:url("./images/albums_background.png");
	position:absolute;
	left:0;
	top:0;
	width: 180px;
	height: 100%;
	margin-top:0px;
	margin-bottom:0px;
}
#collages img {
	margin: 10px;
}

#content {
	margin-left:180px;
	color:white;
}
#content img {
	border:0;
	display:block;
	margin-left:auto;
	margin-right:auto;
}

.collageImg {
	border: 1px solid white;
}

.collageThumb {
	opacity:0.4;filter:alpha(opacity=40);
	border: 1px solid white;
}

#g1img1, #g1img2, #g1img3, #g1img4, #g1img5, #g1img6, #g1img7, #g1img8, #g1img9, #g1img10, #g1img11 {
	position: absolute; top: 60px; left: 4px;
}
#g1img11 {
	opacity:0.4;filter:alpha(opacity=40);
}

#g2img1, #g2img2, #g2img3, #g2img4, #g2img5, #g2img6, #g2img7, #g2img8, #g2img9, #g2img10, #g2img11 {
		position: absolute; top: 180px; left: 4px;
}
#g2img11 {
		opacity:0.4;filter:alpha(opacity=40);
}

#g3img1, #g3img2, #g3img3, #g3img4, #g3img5, #g3img6, #g3img7, #g3img8, #g3img9, #g3img10, #g3img11 {
		position: absolute; top: 300px; left: 4px;
}
#g3img11 {
		opacity:0.4;filter:alpha(opacity=40);
}

#g4img1, #g4img2, #g4img3, #g4img4, #g4img5, #g4img6, #g4img7, #g4img8, #g4img9, #g4img10, #g4img11, #g4img12 {
		position: absolute; top: 420px; left: 4px;
}
#g4img12 {
		opacity:0.4;filter:alpha(opacity=40);
}
</pre>
<p>The way that it is implemented is pretty simple. In order to make this work, I relied on a naming convention. Lets look at one image:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p394code25'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p39425"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p394code25"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;./pictures/Blue/Erie Night.jpg&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;lytebox[one]&quot;</span> title<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Erie Night&quot;</span><span style="color: #339933;">&gt;&lt;</span>img id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;g1img1&quot;</span> <span style="color: #003366; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;collageImg&quot;</span> style<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;display:none;&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;./pictures/Blue/Erie Night (1).jpg&quot;</span><span style="color: #339933;">/&gt;&lt;/</span>a<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>The id of the image is set to g1 for 'gallery 1', img1 for 'image 1'. If you look at the html, I had to add this logical id to every image. This is a very tedious process. There is also the code for lytebox, namely the rel="lytebox[one]" to launch the lytebox script when the image is clicked, and link all the 'one' galleries together. The other thing on this line is the style="display:none;" part. This bugs me, but it appears to be a css limitation I can't get around. Because all the images are stacked, they all appear in turn as they are downloaded without this. If I put this style in the css, then javascript can't turn it back on! It has to be an inline style. I would love to hear a solution for this.</p>
<p>Then we have one more line from the html file to look at.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p394code26'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p39426"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p394code26"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#&quot;</span> onClick<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;collage1.swap();&quot;</span><span style="color: #339933;">&gt;&lt;</span>img id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;g1img11&quot;</span> <span style="color: #003366; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;collageThumb&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;./pictures/Blue/Montana Road (1).jpg&quot;</span><span style="color: #339933;">/&gt;&lt;/</span>a<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>This line is the last line in each gallery, and is the last image repeated. This is the one that will not move, and forms the thumbnail for the gallery. Via css, the transparency is lowered when the collage is out. This image contains the onClick call to move the images.</p>
<p>Now onto the javascript. Look at this bit of code that defines a collage:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p394code27'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p39427"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p394code27"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> collage1 <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Collage<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;g1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
collage1.<span style="color: #660066;">endPoints</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">280</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">80</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">300</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">180</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">400</span><span style="color: #339933;">,</span><span style="color: #CC0000;">100</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">580</span><span style="color: #339933;">,</span><span style="color: #CC0000;">120</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">500</span><span style="color: #339933;">,</span><span style="color: #CC0000;">200</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">280</span><span style="color: #339933;">,</span><span style="color: #CC0000;">400</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">340</span><span style="color: #339933;">,</span><span style="color: #CC0000;">320</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">540</span><span style="color: #339933;">,</span><span style="color: #CC0000;">290</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">480</span><span style="color: #339933;">,</span><span style="color: #CC0000;">380</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">620</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">440</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
collage1.<span style="color: #660066;">startPoint</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">60</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>This defines gallery 1 ("g1"). All those numbers are the end points for where each image will be when the collage is expanded. Again, this is a pain, and it can be confusing which image you are adjusting when changing the numbers.</p>
<p>So lets look at the open function:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p394code28'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p39428"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p394code28"><pre class="javascript" style="font-family:monospace;">Collage.<span style="color: #660066;">prototype</span>.<span style="color: #000066;">open</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	Collage.<span style="color: #660066;">closeAll</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">endPoints</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		$image <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #000066;">name</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'img'</span><span style="color: #339933;">+</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">+</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">new</span> Effect.<span style="color: #660066;">Move</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span>$image<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> x<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">endPoints</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> y<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">endPoints</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> mode<span style="color: #339933;">:</span> <span style="color: #3366CC;">'absolute'</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">state</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;open&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>This is pretty simple. Once I found the Effect.Move() function of scriptaculous, this simply loops over the images in the gallery, and tells the Move function to move the images from where it is (stacked with the others), to the endpoint. The close is similar. It moves the images from where they are (the endpoints) to the start point that was defined in the gallery definition.</p>
<p>The rest of the script is pretty simple. The other methods show all the images (doOnLoad), or set up the swap.</p>
<p>What could be improved? A lot. I don't like defining the galleries and the images through the id field. The user of the collage js has to have intimate knowledge of how the script works in order to set it up. Not only that, but you need matching elements defined in CSS correctly. Having the end point definitions in the js is a pain too. Would would be better, is to come up with a way to have the javascript scan the html and look for images to use, much like how lytebox does it via the rel attribute. Well, guess what? That is exactly what I am working on!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2009/01/moving-pictures-via-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Christopher Ward Photography</title>
		<link>http://www.cyberward.net/blog/2009/01/christopher-ward-photography-2/</link>
		<comments>http://www.cyberward.net/blog/2009/01/christopher-ward-photography-2/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 03:21:18 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[Site News]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=341</guid>
		<description><![CDATA[I finally have my pictures up at Christopher Ward Photography. I was hoping to get them up before the end of the year, but a couple of days isn&#8217;t too bad. I had thought that I would go with a site at smugmug, and I may later, but I had an idea for some javascript-y-ness [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 160px"><img title="Gerbera" src="http://www.christopherwardphotography.com/pictures/Green/Gerbera%20(1).jpg" alt="Gerbera photo from new gallary" width="150" height="100" /><p class="wp-caption-text">Gerbera photo from new gallary</p></div>
<p>I finally have my pictures up at <a href="http://www.christopherwardphotography.com/">Christopher Ward Photography</a>. I was hoping to get them up before the end of the year, but a couple of days isn&#8217;t too bad. I had thought that I would go with a site at smugmug, and I may later, but I had an idea for some javascript-y-ness that I wanted to try first. The album&#8217;s on the left contain pictures that fly out into a collage. I will post more on the Javascript later. I tried something different with the albums too. Annie had the idea to group them by color, instead of landscape, people, etc. I think it worked pretty well. I have some images that I wasn&#8217;t able to get in because of it, but the individual collages look better and more cohesive this way.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2009/01/christopher-ward-photography-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript Speed Tests</title>
		<link>http://www.cyberward.net/blog/2008/12/javascript-speed-tests/</link>
		<comments>http://www.cyberward.net/blog/2008/12/javascript-speed-tests/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 15:47:45 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=318</guid>
		<description><![CDATA[As part two of yesterdays Javascript Speed post, I have an interresting link. MooTools, another Javascript library, has a speed comparison page up here. I had looked at MooTools a while back when I put up the slideshow piece on the front page of the site. I didn&#8217;t look into it too much, but it [...]]]></description>
			<content:encoded><![CDATA[<p>As part two of yesterdays Javascript Speed post, I have an interresting link. <a href="http://mootools.net">MooTools</a>, another Javascript library, has a speed comparison page up <a href="http://mootools.net/slickspeed/">here</a>. I had looked at MooTools a while back when I put up the slideshow piece on the front page of the site. I didn&#8217;t look into it too much, but it seemed small and compact. Anyway, the speed comparison is interresting. If you go to the site, press the &#8220;start tests&#8221; button in the upper right to see the differences. I got here while I was looking into <a href="http://jquery.com/">jQuery</a>. Prototype gets smacked in the speed test. Yikes.</p>
<p>This post is from 2007, but was already complaining that <a href="http://wordpress.org">Wordpress</a> was going to use Prototype instead of jQuery for version 2.0. (which was just released a month ago) It would appear to me though that Wordpress went and switched to jQuery. Looking at the Wordpress docs, I found this page on <a href="http://codex.wordpress.org/AJAX_in_Plugins">AJAX</a>, and it talks about jQuery.¬† When I look at the source of one of the admin pages, there is jQuery references all over, but nothing about prototype.</p>
<p>Looks like Wordpress has switched to jQuery, and if I am looking at making plugins for wordpress, I might want to think about moving to jQuery.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2008/12/javascript-speed-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript Speed</title>
		<link>http://www.cyberward.net/blog/2008/12/javascript-speed/</link>
		<comments>http://www.cyberward.net/blog/2008/12/javascript-speed/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 19:38:26 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=313</guid>
		<description><![CDATA[I have been working on a new script that will &#8220;fly&#8221; collages out from an album. It was using an effect from script.aculo.us. I am much closer, and am in the process of gathering images to post before I call it done. I tested it with Safari, Windows Explorer 6, and Firefox 3.0. I have [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working on a new script that will &#8220;fly&#8221; collages out from an album. It was using an effect from <a href="http://script.aculo.us/">script.aculo.us</a>. I am much closer, and am in the process of gathering images to post before I call it done. I tested it with Safari, Windows Explorer 6, and Firefox 3.0. I have to say, it was crazy smooth in Safari and Explorer. I was disapointed in Firefox. It is a little jerky. It was in development, but I figured that was just something to live with until I tried the other browsers.</p>
<p>There is hope. Firefox 3.1 is in beta (<a href="http://arstechnica.com/news.ars/post/20081014-first-look-firefox-3-1-beta-1-officially-released.html">as of October</a>), and it is supposed to have Tracemonkey support among other things. All the browsers have been <a href="http://arstechnica.com/journals/apple.ars/2008/09/19/squirrelfish-extreme-mops-floor-with-v8-tracemonkey">madly</a> <a href="http://arstechnica.com/journals/linux.ars/2008/10/07/extreme-javascript-performance">working</a> on their javascript kung fu it would appear. I haven&#8217;t tried the beta, but here&#8217;s hoping for a smoother ride once it hits prime time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2008/12/javascript-speed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
