<?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>FerretArmy: A Web Developer&#039;s Paradise &#187; jQuery</title>
	<atom:link href="http://www.ferretarmy.com/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ferretarmy.com</link>
	<description>Pushing the Web Forward, Since 2007</description>
	<lastBuildDate>Wed, 18 Jan 2012 15:58:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Extending jQuery Selectors: &#8216;between&#8217;</title>
		<link>http://www.ferretarmy.com/2010/05/10/extending-jquery-selectors-between/</link>
		<comments>http://www.ferretarmy.com/2010/05/10/extending-jquery-selectors-between/#comments</comments>
		<pubDate>Mon, 10 May 2010 20:23:52 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[Geeky]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[extending jQuery]]></category>

		<guid isPermaLink="false">http://www.ferretarmy.com/?p=516</guid>
		<description><![CDATA[There are a ton of jQuery selectors to get at just about any data imaginable on a page. Between actual selectors (such as ID and attribute selectors) and pseudo-selectors (such as :first and :checked), the bulk of HTML element selection is trivial. There are, however, a few selectors I&#8217;ve had a need for but aren&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>There are a ton of jQuery selectors to get at just about any data imaginable on a page. Between actual selectors (such as ID and attribute selectors) and pseudo-selectors (such as :first and :checked), the bulk of HTML element selection is trivial. There are, however, a few selectors I&#8217;ve had a need for but aren&#8217;t in jQuery currently &#8211; for instance, there is a <a href="http://api.jquery.com/next-adjacent-Selector/">next adjacent selector</a>, but there is no analogous &#8216;previous adjacent&#8217; selector baked in. How does one get around this? Let&#8217;s find out, after the jump.</p>
<p><span id="more-516"></span></p>
<p>There is a solution, of course &#8211; just like almost every part of jQuery, the <a href="http://sizzlejs.com/">Sizzle  selector engine</a> is extensible. That&#8217;s right &#8211; you can implement your own selectors that you can then use just like native selectors (big props to Ben Nadel for <a href="http://www.bennadel.com/blog/1457-How-To-Build-A-Custom-jQuery-Selector.htm">demonstrating this technique</a>). One of my first needs in this realm was to create a &#8216;between&#8217; selector &#8211; give me all the elements &#8216;between&#8217; selectors for element A and element B. Here&#8217;s an example of what we want the syntax to look like:</p>
<pre style="padding-left: 30px;">var rowsBetween = $('tr:between(tr:contains(Start), tr:contains(End))');
</pre>
<p>Given the selector above, we would expect it to return the following table rows:</p>
<p><a href="http://www.ferretarmy.com/wp-content/uploads/2010/05/capRows.png"><img class="alignnone size-full wp-image-517" title="Rows To Capture" src="http://www.ferretarmy.com/wp-content/uploads/2010/05/capRows.png" alt="" width="398" height="178" /></a></p>
<p>In order to implement this selector, we&#8217;re going to make a few assumptions in order to get it to work. First, we&#8217;re going to assume that both the inside selectors resolve to a single element (actually, they can resolve to any number of elements, we will just use only the first match). Next, we are going to assume that the first element actually occurs before the last element. These assumptions obviously make for a buggy implementation of a real selector, but they are perfectly acceptable for a user-driven project.<br />
So, down to it. The first thing we are going to do is setup the jQuery selector engine extension method:</p>
<pre>$.expr[':'].between = function(
    objNode,
    intStackIndex,
    arrProperties,
    arrNodeStack)
{
	// Placeholder logic...
	return false;
};
</pre>
<p>Ben Nadel has an excellent writeup on the selector engine interface in his article http://www.bennadel.com/blog/1457-How-To-Build-A-Custom-jQuery-Selector.htm, so no need to cover it again. Now, our next task is to write the guts of our selector. Here&#8217;s the algorithm we are going to be implementing:</p>
<ol>
<li>Split the arguments by &#8216;,&#8217; (comma), so that we have the start and end selectors.</li>
<li>Find the start and end elements that correspond to the start and end selectors.</li>
<li>Is the element we are currently testing between the start and end elements?
<ol>
<li>Yes -&gt; return true</li>
<li>No -&gt; return false</li>
</ol>
</li>
</ol>
<p>This is a relatively easy algorithm to implement. First, let&#8217;s do the chopping:</p>
<pre>    var args = arrProperties[3].split(",");
    var startSelector = args[0];
    var endSelector = args[1];
</pre>
<p>Now that we have the &#8216;between&#8217; selector values, let&#8217;s get the corresponding elements from the element collection.</p>
<pre> var startIndex = -1;
    var endIndex = -1;

    // Find the start and end indexes.
    for (var index = 0; index &lt; arrNodeStack.length; index++)
    {
        if ($(arrNodeStack[index]).is(startSelector) &amp;&amp; startIndex &lt; 0)
            startIndex = index;
        else if ($(arrNodeStack[index]).is(endSelector) &amp;&amp; endIndex &lt; 0)
            endIndex = index;
    }
</pre>
<p><em>$(arrNodeStack[index])</em> gives us the element that we are currently iterating over. In order to see if it matches our start/end selector, we use the jQuery <a href="http://api.jquery.com/is/">is()</a> method. We have a little handling here to keep from overwriting our values if we&#8217;ve already found a match, but it&#8217;s all pretty self-explanatory.</p>
<p>Our last task is to check to see if our selected element is between the start and end elements, and return the appropriate value. That again is pretty straightforward:</p>
<pre>    if (startIndex &gt;= 0 &amp;&amp;
        endIndex &gt; 0 &amp;&amp;
        intStackIndex &gt; startIndex &amp;&amp;
        intStackIndex &lt; endIndex)
        return true;
    else
        return false;
</pre>
<p>Putting this all together, we get the following:</p>
<pre>$.expr[':'].between = function(
    objNode,
    intStackIndex,
    arrProperties,
    arrNodeStack)
{
    var args = arrProperties[3].split(",");
    var startSelector = args[0];
    var endSelector = args[1];

    var startIndex = -1;
    var endIndex = -1;

    // Find the start and end indexes.
    for (var index = 0; index &lt; arrNodeStack.length; index++)
    {
        if ($(arrNodeStack[index]).is(startSelector) &amp;&amp; startIndex &lt; 0)
            startIndex = index;
        else if ($(arrNodeStack[index]).is(endSelector) &amp;&amp; endIndex &lt; 0)
            endIndex = index;
    }

    if (startIndex &gt;= 0 &amp;&amp;
        endIndex &gt; 0 &amp;&amp;
        intStackIndex &gt; startIndex &amp;&amp;
        intStackIndex &lt; endIndex)
        return true;
    else
        return false;
};
</pre>
<p>That&#8217;s it! We&#8217;ve now got the ability to use the &#8216;between&#8217; selector just like any other jQuery selector. Pretty simple, no? From not knowing a thing about selector engine extension to a finished product, this was only a few hours of work (mostly research, too). If you&#8217;re looking for an opportunity to try implementing a custom selector, try that &#8216;previous adjacent&#8217; selector I talked about in the opening paragraph &#8211; it should be pretty easy to implement.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ferretarmy.com/2010/05/10/extending-jquery-selectors-between/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Image Overlay 1.3 Released</title>
		<link>http://www.ferretarmy.com/2010/03/29/jquery-image-overlay-1-3-released/</link>
		<comments>http://www.ferretarmy.com/2010/03/29/jquery-image-overlay-1-3-released/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 17:41:06 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[Image Overlay]]></category>

		<guid isPermaLink="false">http://www.ferretarmy.com/?p=509</guid>
		<description><![CDATA[There have been a distinct lack of updates recently on FerretArmy.com &#8211; chock it up to having to do a lot of work-induced overtime over the past few months. Either way, in order to usher in some fresher content, I&#8217;ve updated my Image Overlay plugin to version 1.3. Changes are that you no longer need [...]]]></description>
			<content:encoded><![CDATA[<p>There have been a distinct lack of updates recently on FerretArmy.com &#8211; chock it up to having to do a lot of work-induced overtime over the past few months. Either way, in order to usher in some fresher content, I&#8217;ve updated my Image Overlay plugin to <a href="http://www.ferretarmy.com/files/jQuery/ImageOverlay/ImageOverlay.html">version 1.3</a>. Changes are that you no longer need to specify image width and height, as well as being able to specify different animation speeds for the &#8216;in&#8217; and &#8216;out&#8217; animations.  Hope you enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ferretarmy.com/2010/03/29/jquery-image-overlay-1-3-released/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>jQuery 1.4 Preview</title>
		<link>http://www.ferretarmy.com/2009/10/23/jquery-1-4-preview/</link>
		<comments>http://www.ferretarmy.com/2009/10/23/jquery-1-4-preview/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 20:02:05 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.ferretarmy.com/?p=470</guid>
		<description><![CDATA[I just found this preview of jQuery 1.4. I read some of this stuff at the jQuery site, but this is a nice explanation of the proposed functionality of the next major version of jQuery. I think the new &#8216;live&#8217; event handlers are going to be great. I can&#8217;t stress how much the &#8216;live&#8217; method [...]]]></description>
			<content:encoded><![CDATA[<p>I just found this <a href="http://www.myphpetc.com/2009/10/preview-of-whats-new-in-jquery-14.html">preview of jQuery 1.4</a>. I read some of this stuff at the jQuery site, but this is a nice explanation of the proposed functionality of the next major version of jQuery.</p>
<p>I think the new &#8216;live&#8217; event handlers are going to be great. I can&#8217;t stress how much the &#8216;live&#8217; method has helped my JavaScript development &#8211; it makes event binding much less of a chore when dynamically creating page content (especially for trivial things, like bindings for button hover behavior). One of the things I&#8217;ve disliked, though, is the change event of dropdowns isn&#8217;t able to be live captured, which has led me to use <a href="http://plugins.jquery.com/project/livequery/">Live Query</a> for those purposes. With 1.4, it can be done with jQuery alone.</p>
<p>It will certainly be interesting to see if the Lazy Load code is included, for on-the-fly .css and .js includes. By conditionally loading javascript and css, a lot of bandwidth could be conserved by choosing to defer file retrieval for little-used site features.</p>
<p>Some of the other cool new features will undoubtedly be radio classes and the offset get/set methods &#8211; I can see using those to save a few lines of code. I&#8217;m betting that there will also be some performance increases with 1.4, so I&#8217;m excited about the release, even if it&#8217;s release is still a few months off yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ferretarmy.com/2009/10/23/jquery-1-4-preview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery UI Image Carousel</title>
		<link>http://www.ferretarmy.com/2009/09/29/jquery-ui-image-carousel/</link>
		<comments>http://www.ferretarmy.com/2009/09/29/jquery-ui-image-carousel/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 16:43:03 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery UI]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[WebDev]]></category>

		<guid isPermaLink="false">http://www.ferretarmy.com/?p=458</guid>
		<description><![CDATA[I&#8217;ve just released my latest plugin, the jQuery UI Image Carousel! The plugin is a standard-fare image carousel, and it&#8217;s also fully compatible with jQuery UI. It&#8217;s got a few options that make it fairly versatile &#8211; from a minimal look all the way to a collapsible version with a custom header. The JavaScript itself [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.ferretarmy.com/files/jQuery/ImageCarousel/ImageCarousel.html"><img class="size-full wp-image-459 aligncenter" title="jQuery UI Image Carousel" src="http://www.ferretarmy.com/wp-content/uploads/2009/09/carouselPic.jpg" alt="jQuery UI Image Carousel" width="211" height="125" /></a></p>
<p>I&#8217;ve just released my latest plugin, the <a href="http://www.ferretarmy.com/files/jQuery/ImageCarousel/ImageCarousel.html">jQuery UI Image Carousel</a>! The plugin is a standard-fare image carousel, and it&#8217;s also fully compatible with <a href="http://jqueryui.com/">jQuery UI</a>. It&#8217;s got a few options that make it fairly versatile &#8211; from a minimal look all the way to a collapsible version with a custom header.</p>
<p>The JavaScript itself wasn&#8217;t that daunting &#8211; version 1.0 clocks in at around 180 lines. Most of it is presentation management as well &#8211; making sure that the correct jQuery UI classes are applied to the markup, and so forth. In total, it was a bit of a longer exercise &#8211; there was a lot of work to insure compatibility with older versions of IE, for instance. I hope you enjoy, and if you use it, please take a sec to leave a comment with your page URL.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ferretarmy.com/2009/09/29/jquery-ui-image-carousel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disabling Button Clicks The Better Way</title>
		<link>http://www.ferretarmy.com/2009/09/18/disabling-button-clicks-the-better-way/</link>
		<comments>http://www.ferretarmy.com/2009/09/18/disabling-button-clicks-the-better-way/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 17:57:35 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery UI]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.ferretarmy.com/?p=449</guid>
		<description><![CDATA[Most of the time when you want to cancel an action on a web page, such as a button click, you&#8217;d return false in the client-side button event handler, as such: &#60;a href="blah..." onclick="return DoAction();"&#62;Link&#60;/a&#62; ... function DoAction() { /*Do Something */ return false; }; However, there&#8217;s a better way, using the event.preventDefault() method. I [...]]]></description>
			<content:encoded><![CDATA[<p>Most of the time when you want to cancel an action on a web page, such as a button click, you&#8217;d return false in the client-side button event handler, as such:</p>
<p><code>&lt;a href="blah..." onclick="return DoAction();"&gt;Link&lt;/a&gt;</code></p>
<p><code>...</code></p>
<p><code>function DoAction() { /*Do Something */ return false; };</code></p>
<p>However, there&#8217;s a better way, using the <a href="https://developer.mozilla.org/en/DOM/event.preventDefault">event.preventDefault()</a> method. I had the need to use this recently, when I was fixing a trivial issue with the <a href="http://www.filamentgroup.com/lab/styling_buttons_and_toolbars_with_the_jquery_ui_css_framework/">Filament Group jQuery UI buttons</a> &#8211; my &#8216;a href&#8217; styled buttons were still clickable when they were disabled. An easy solution to this problem is to capture the click and prevent the default action. I hooked this action to all disabled buttons, as such.</p>
<p><code>$(".ui-state-disabled").click(function(event) { event.preventDefault(); });</code></p>
<p>This code isn&#8217;t that robust &#8211; if you were to add or remove the ui-state-disabled class after page load (which I didn&#8217;t have to), you&#8217;d want to make sure to handle it appropriately. Either way, preventDefault() is definitely an elegant solution to disabling a click action.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ferretarmy.com/2009/09/18/disabling-button-clicks-the-better-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Image Overlay 1.2</title>
		<link>http://www.ferretarmy.com/2009/09/09/jquery-image-overlay-1-2/</link>
		<comments>http://www.ferretarmy.com/2009/09/09/jquery-image-overlay-1-2/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 04:51:07 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[Image Overlay]]></category>

		<guid isPermaLink="false">http://www.ferretarmy.com/?p=447</guid>
		<description><![CDATA[I&#8217;ve updated my image overlay plugin yet again, to version 1.2. Again, it was a fairly minor enhancement &#8211; I added the ability to turn off the animation via an option. The translucent image overlay effect is popping up all over the web nowadays, and I want to make sure that my plugin implementation offers [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve updated my image overlay plugin yet again, to <a href="http://www.ferretarmy.com/files/jQuery/ImageOverlay/ImageOverlay.html">version 1.2</a>. Again, it was a fairly minor enhancement &#8211; I added the ability to turn off the animation via an option. The translucent image overlay effect is popping up all over the web nowadays, and I want to make sure that my plugin implementation offers as much as any other technique to achieve the overlay effect.</p>
<p>In other development, I&#8217;ve been trying to learn how to implement iPhone style gesture controls via JavaScript. I&#8217;ve been seriously spinning my wheels on this &#8211; my demo is turning out to be a dud, of sorts. It&#8217;s frustrating (especially the testing, which I can only do on my iPhone currently), but hopefully it comes together sooner or later.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ferretarmy.com/2009/09/09/jquery-image-overlay-1-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery Image Overlay Plugin 1.1</title>
		<link>http://www.ferretarmy.com/2009/08/21/jquery-image-overlay-plugin-1-1/</link>
		<comments>http://www.ferretarmy.com/2009/08/21/jquery-image-overlay-plugin-1-1/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 17:12:35 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[Geeky]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[Image Overlay]]></category>

		<guid isPermaLink="false">http://www.ferretarmy.com/?p=442</guid>
		<description><![CDATA[A quick note &#8211; I&#8217;ve updated my jQuery Image Overlay Plugin to version 1.1. This version adds support for pinning the overlay so it is always viewable (not just when you mouse over the image). There were no other changes, so you should be able to upgrade without worry.]]></description>
			<content:encoded><![CDATA[<p>A quick note &#8211; I&#8217;ve updated my <a href="http://www.ferretarmy.com/files/jQuery/ImageOverlay/ImageOverlay.html">jQuery Image Overlay Plugin</a> to version 1.1. This version adds support for pinning the overlay so it is always viewable (not just when you mouse over the image). There were no other changes, so you should be able to upgrade without worry.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ferretarmy.com/2009/08/21/jquery-image-overlay-plugin-1-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery Image Overlay Plugin</title>
		<link>http://www.ferretarmy.com/2009/07/26/jquery-image-overlay-plugin/</link>
		<comments>http://www.ferretarmy.com/2009/07/26/jquery-image-overlay-plugin/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 19:30:43 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[Geeky]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery UI]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[Image Overlay]]></category>
		<category><![CDATA[metadata plugin]]></category>

		<guid isPermaLink="false">http://www.ferretarmy.com/?p=415</guid>
		<description><![CDATA[I&#8217;ve created my first jQuery plugin this week &#8211; it&#8217;s an image overlay plugin (the static pic above doesn&#8217;t do the plugin justice, so click through to see it in action). Creating a jQuery plugin isn&#8217;t that big a stretch for a competent JavaScript developer. There are quite a few tutorials out there where you [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.ferretarmy.com/files/jQuery/ImageOverlay/ImageOverlay.html"><img class="size-full wp-image-416 aligncenter" title="jQuery Image Overlay Plugin" src="http://www.ferretarmy.com/wp-content/uploads/2009/07/Image-Overlay.jpg" alt="jQuery Image Overlay Plugin" width="204" height="202" /></a></p>
<p>I&#8217;ve created my first jQuery plugin this week &#8211; it&#8217;s an <a href="http://www.ferretarmy.com/files/jQuery/ImageOverlay/ImageOverlay.html">image overlay plugin</a> (the static pic above doesn&#8217;t do the plugin justice, so click through to see it in action).</p>
<p>Creating a jQuery plugin isn&#8217;t that big a stretch for a competent JavaScript developer. There are quite a few tutorials out there where you can grab a template and start working very quickly. In addition to writing my plugin, I also made sure that it supported the <a href="http://plugins.jquery.com/project/metadata">metadata plugin</a>, so that you can dynamically change properties on individual galleries and images, which should go a long way towards usefulness.</p>
<p>If you end up using this plugin, drop a line in the comments with a link so we can check out your work. Hope you enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ferretarmy.com/2009/07/26/jquery-image-overlay-plugin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Full Screen Canvas Particle Demo</title>
		<link>http://www.ferretarmy.com/2009/07/21/full-screen-canvas-particle-demo/</link>
		<comments>http://www.ferretarmy.com/2009/07/21/full-screen-canvas-particle-demo/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 00:50:54 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[canvas]]></category>
		<category><![CDATA[Geeky]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[canvas tag]]></category>

		<guid isPermaLink="false">http://www.ferretarmy.com/?p=386</guid>
		<description><![CDATA[I created a new version of my particle demo using the HTML5 &#60;canvas&#62;. This version is full screen, inspired by this amazing canvas demo at Iteration Six. I&#8217;d seen their demo prior to my starting to tinker with the canvas tag, but I never really tore it apart and looked inside. From what it appears, [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.ferretarmy.com/files/canvas/fullScreenCanvas/fullScreenCanvas.html"><img class="size-full wp-image-387   aligncenter" style="border: 1px solid #000000;" title="Full Screen Particle Demo" src="http://www.ferretarmy.com/wp-content/uploads/2009/07/fullScreenParticle.png" alt="Full Screen Particle Demo" width="338" height="251" /></a></p>
<p>I created a new version of my <a href="http://www.ferretarmy.com/files/canvas/fullScreenCanvas/fullScreenCanvas.html">particle demo</a> using the HTML5 &lt;canvas&gt;. This version is full screen, inspired by this <a href="http://iterationsix.com/projects/particle_fountain">amazing canvas demo</a> at Iteration Six. I&#8217;d seen their demo prior to my starting to tinker with the canvas tag, but I never really tore it apart and looked inside. From what it appears, my code and their code were achieving a lot of the same things, so I decided to update mine to take advantage of some of the exciting features in their demo, including the full screen mode and the mouse interactions.</p>
<p>This demo uses a bit more <a href="http://jquery.com/">jQuery</a> than the previous one to handle mouse events. The canvas is much larger than the previous one, so I had to make some small changes to increase performance. Most notably, I had to halve the framerate &#8211; this demo runs at 10fps rather than 20. I sped up the particle speed so they cover distance quicker as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ferretarmy.com/2009/07/21/full-screen-canvas-particle-demo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>HTML5 Canvas Particle Example</title>
		<link>http://www.ferretarmy.com/2009/07/19/html5-canvas-particle-example/</link>
		<comments>http://www.ferretarmy.com/2009/07/19/html5-canvas-particle-example/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 22:58:44 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[canvas]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[canvas tag]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.ferretarmy.com/?p=378</guid>
		<description><![CDATA[Here&#8217;s a cool particle demonstration of the HTML5 &#60;canvas&#62; tag. It&#8217;s a tremendously small amount of JavaScript code that is responsible for pushing some radial gradient particles around a canvas. You can check out the source code to see how things are done &#8211; it uses jQuery a bit and the demo itself uses a [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.ferretarmy.com/files/canvas/canvasParticle/canvasParticle2.html"><img class="size-full wp-image-379 aligncenter" style="border: 1px solid #000;" title="Canvas Particle Demo" src="http://www.ferretarmy.com/wp-content/uploads/2009/07/canvasParticle.png" alt="Canvas Particle Demo" width="300" height="200" /></a></p>
<p>Here&#8217;s a cool <a href="http://www.ferretarmy.com/files/canvas/canvasParticle/canvasParticle2.html">particle demonstration</a> of the HTML5 &lt;canvas&gt; tag. It&#8217;s a tremendously small amount of JavaScript code that is responsible for pushing some radial gradient particles around a canvas. You can check out the source code to see how things are done &#8211; it uses <a href="http://jquery.com/">jQuery</a> a bit and the demo itself uses a free <a href="http://www.eyecon.ro/colorpicker/">color picker control</a>.</p>
<p>The demo works best in Firefox. Chrome has some ugly rendering artifacts when the gradients cross over one another and Safari can&#8217;t push a lot of particles on the screen without dying, but Firefox can render several hundred particles with ease (Internet Explorer doesn&#8217;t support &lt;canvas&gt; at all). If the computation for this demo were to be done on a GPU rather than a CPU, you&#8217;d probably be able to pump out thousands of particles with no issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ferretarmy.com/2009/07/19/html5-canvas-particle-example/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

