<?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>PixelMEDIA &#187; jQuery</title>
	<atom:link href="http://www.pixelmedia.com/blog/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pixelmedia.com/blog</link>
	<description>The official staff chatter blox</description>
	<lastBuildDate>Thu, 22 Dec 2011 15:55:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Gone in a Flash?  How jQuery can improve your site performance and your bottom line.</title>
		<link>http://www.pixelmedia.com/blog/gone-in-a-flash-how-jquery-can-improve-your-site-performance-and-your-bottom-line/</link>
		<comments>http://www.pixelmedia.com/blog/gone-in-a-flash-how-jquery-can-improve-your-site-performance-and-your-bottom-line/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 13:39:49 +0000</pubDate>
		<pxlAuthorId>28</pxlAuthorId>
		<dc:creator>mroach</dc:creator>
				<category><![CDATA[Application development]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[search engine optimization]]></category>
		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://blog.pixelmedia.com/?p=807</guid>
		<description><![CDATA[As new plugins become available to developers every day, jQuery is quickly becoming one of the most popular javascript libraries.  jQuery is an easy solution for interactive development and a remarkable alternative to traditional flash-based components.  In fact, the versatility &#8230; <a href="http://www.pixelmedia.com/blog/gone-in-a-flash-how-jquery-can-improve-your-site-performance-and-your-bottom-line/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As new plugins become available to developers every day, jQuery is quickly becoming one of the most popular javascript libraries.  jQuery is an easy solution for interactive development and a remarkable alternative to traditional flash-based components.  In fact, the versatility of jQuery is truly astounding and in many ways, makes it a much better alternative to Flash.  </p>
<p>Although jQuery isn&#8217;t known to be the best solution for 3-D and vector-based graphics, there are several other areas in which jQuery out-performs Flash.<span id="more-807"></span></p>
<p><strong>Search Engine Friendly: </strong><br />
Your site&#8217;s content is not locked up in Flash file, thus making it accessible to search engine bots and screen readers. Freeing up your content can drastically increase your site rankings.</p>
<p><strong>User-Friendly: </strong><br />
jQuery doesn’t require a plug-in like Flash does.  Your Web 1.0 user won’t need to download anything to view or interact with the functionality on your site.  </p>
<p><strong>Browser-Friendly, Mobile-Browser-Friendly</strong><br />
jQuery is supported by most browsers (provided the user hasn’t disabled Javascript), including Safari on the iPhone.  To date, Flash is not supported by the iPhone.</p>
<p><strong>Developer-Friendly:</strong><br />
jQuery is executed through Javascript, HTML and CSS.  No Flash developers are required.  Also, subject to debate, but the learning curve with jQuery isn’t nearly as steep as Flash.</p>
<p><strong>Budget-Friendly:</strong><br />
jQuery is completely free.  Adobe Flash costs upwards of $700, and that&#8217;s before you&#8217;ve even begun to scope a designer to do the work.</p>
<p><strong>Server-Friendly:</strong><br />
jQuery code is lightweight: no large Flash files, no large downloads.</p>
<p>As more and more plug-ins become available and gain support from the developer community, it&#8217;s important to keep in mind that there may already be a jQuery solution for your needs out there.  Depending on what you&#8217;re trying to achieve, it&#8217;s important to evaluate both technologies.  If there is a jQuery solution, it may provide a more cost-effective solution for you &#8211; and a better experience for your users.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelmedia.com/blog/gone-in-a-flash-how-jquery-can-improve-your-site-performance-and-your-bottom-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Binding a click event inside a click event with jQuery</title>
		<link>http://www.pixelmedia.com/blog/binding-a-click-event-inside-a-click-event-with-jquery/</link>
		<comments>http://www.pixelmedia.com/blog/binding-a-click-event-inside-a-click-event-with-jquery/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 15:47:37 +0000</pubDate>
		<pxlAuthorId>21</pxlAuthorId>
		<dc:creator>Jeff L</dc:creator>
				<category><![CDATA[Application development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://blog.pixelmedia.com/?p=457</guid>
		<description><![CDATA[I was recently working on coding a design that included a simple type of faux select element. It was basically an unordered list that expanded and collapsed when you clicked a link. As it was styled similar to a select &#8230; <a href="http://www.pixelmedia.com/blog/binding-a-click-event-inside-a-click-event-with-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I was recently working on coding a design that included a simple type of faux select element. It was basically an unordered list that expanded and collapsed when you clicked a link. As it was styled similar to a select element, the JavaScript behaviors were similar as well. Clicking the link expanded the list underneath it, and you could then choose a link inside the list and navigate away from the page, or click the original link to close the list again.</p>
<p>The client, however, found this a bit confusing<span id="more-457"></span>—once they had expanded the hidden list, it wasn&#8217;t obvious to them how to close it. They wanted to be able to click somewhere else on the page and have the list close so they could continue browsing. No problem, I figured, a few JavaScript tweaks and we&#8217;d be all set. Simply putting a click event on the body element to close the list would be pretty straightforward.</p>
<p>Lets take a look at the code we used:<br />
<code></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> initFauxSelect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a.showSelect'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      e.<span style="color: #660066;">preventDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #003366; font-weight: bold;">var</span> $theList <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.fauxSelect'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.selectList'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      hideShow<span style="color: #009900;">&#40;</span>$theList<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> hideShow<span style="color: #009900;">&#40;</span>obj<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  $theList <span style="color: #339933;">=</span> obj<span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$theList.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">':visible'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    $theList.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</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;">else</span> <span style="color: #009900;">&#123;</span>
    $theList.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p></code></p>
<p>It&#8217;s a simple click event on <code>a.showSelect</code> that calls the <code>hideShow()</code> function. If the list is visible, hide it, otherwise show it.</p>
<p>I figured it would be as simple as binding a new click event to the <code>body</code> tag whenever we show the list. The new event would hide the list when someone clicked elsewhere on the page. Let&#8217;s look at the updated <code>hideShow()</code> code:</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> hideShow<span style="color: #009900;">&#40;</span>obj<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  $theList <span style="color: #339933;">=</span> obj<span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$theList.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">':visible'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    $theList.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">unbind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click.fauxselect'</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;">else</span> <span style="color: #009900;">&#123;</span>
    $theList.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click.fauxselect'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      $theList.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">unbind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click.fauxselect'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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: #009900;">&#125;</span></pre></div></div>

<p></code></p>
<p>Now, whenever we&#8217;re showing the list, we&#8217;re creating a new click event on the <code>body</code> that hides the list. It also unbinds itself once its job is done. If someone closes the list by clicking <code>a.showSelect</code> again, we also unbind the event just to keep things clean.</p>
<p>However, I ran into a problem. The event I was binding to the body was being called right away, which stopped the list from ever appearing! It seemed a bit strange, as my assumption was that you&#8217;d never want your new event to fire as the same time as the current event.</p>
<p>Thankfully, there&#8217;s an easy way prevent this from happening. In our original click event on the <code>.showSelect</code> element, we need to stop that event from bubbling up the DOM.</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> initShortcutsSelect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a.showSelect'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    e.<span style="color: #660066;">preventDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    e.<span style="color: #660066;">stopPropagation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #006600; font-style: italic;">// ----- ADDED THIS LINE</span>
    <span style="color: #003366; font-weight: bold;">var</span> $theList <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.fauxSelect'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.selectList'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    hideShow<span style="color: #009900;">&#40;</span>$theList<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p></code></p>
<p>By telling the event to stopPropagation, it never bubbles up the DOM, never reaches the <code>body</code> and never calls the new click event you bound there until the user actually clicks the body.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelmedia.com/blog/binding-a-click-event-inside-a-click-event-with-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dynamically setting the height of an iframe</title>
		<link>http://www.pixelmedia.com/blog/dynamic-iframe-height/</link>
		<comments>http://www.pixelmedia.com/blog/dynamic-iframe-height/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 18:41:36 +0000</pubDate>
		<pxlAuthorId>21</pxlAuthorId>
		<dc:creator>Jeff L</dc:creator>
				<category><![CDATA[Application development]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://blog.pixelmedia.com/?p=181</guid>
		<description><![CDATA[Recently, we had a situation that required us to pull in some content from one server to another using an iframe. Generally, this is something we would try to avoid, but we needed to pull some data from a new &#8230; <a href="http://www.pixelmedia.com/blog/dynamic-iframe-height/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently, we had a situation that required us to pull in some content from one server to another using an iframe. Generally, this is something we would try to avoid, but we needed to pull some data from a new .NET application into a legacy ColdFusion application.</p>
<p>Unfortunately, the height of the page being pulled in would vary wildly. This led to a fairly disappointing experience where the page was either far too long, or content in the iframe was cut off and the user had to scroll within the iframe to see everything.</p>
<p>We came up with what we thought might be an interesting solution. If the page loading inside of the iframe (the child page) could calculate its height, and somehow let the parent page know, the parent page should be able to reset the height of the iframe.</p>
<p><span id="more-181"></span></p>
<p>With a little <a href="http://tagneto.blogspot.com/2006/10/ie-7-and-iframe-apis-part-2.html?showComment=1163531700000#c116353170380763551" target="_blank">inspiration</a>, we came up with a pretty neat solution that we&#8217;d like to share. Our solution requires that you have the ability to edit the code of both the parent and child pages.</p>
<p>The child page being loaded into the iframe will simply reset the location of the parent page, and include a hash with the height of itself.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #003366; font-weight: bold;">var</span> parentUrl <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;http://example/iframe-outside.html&quot;</span><span style="color: #339933;">;</span>
setHash <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>
    parent.<span style="color: #660066;">location</span> <span style="color: #339933;">=</span> parentUrl <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;#&quot;</span> <span style="color: #339933;">+</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>We&#8217;re using <a href="http://jquery.com/" target="_blank">jQuery </a>here to easily get the height of the &lt;body&gt; tag.</p>
<p>On the parent page that includes the iframe, we&#8217;ll again use jQuery and write a small function that gets the height from the hash in the URL, and uses that to reset the height of the iframe.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>8
9
10
11
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> setHeight<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> newHeight <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>location.<span style="color: #660066;">hash</span>.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #CC0000;">50</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#hashFrame'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'height'</span><span style="color: #339933;">,</span> newHeight<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>We ran into a bit of an issue: the page we were loading was taking a few seconds to load, and we didn&#8217;t want to set our height on the iframe until the content within the iframe had finished loading (and it had a chance to set the proper height to the url hash).</p>
<p>More jQuery to the rescue! The jQuery .load() method allowed us to call our setHeight() function after the iframe had finished loading.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>12
13
14
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#hashFrame'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</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>
    setHeight<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Putting it all together gave us a great way to use our new application inside our legacy application, and make it faily seamless to the end user.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelmedia.com/blog/dynamic-iframe-height/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

