<?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; Jeff L</title>
	<atom:link href="http://www.pixelmedia.com/blog/author/jleombruno/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>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>5 mobile web pointers (hint: it’s more than a new stylesheet)</title>
		<link>http://www.pixelmedia.com/blog/5-mobile-web-pointers/</link>
		<comments>http://www.pixelmedia.com/blog/5-mobile-web-pointers/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 21:09:00 +0000</pubDate>
		<pxlAuthorId>21</pxlAuthorId>
		<dc:creator>Jeff L</dc:creator>
				<category><![CDATA[Application development]]></category>
		<category><![CDATA[Mobile design]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://blog.pixelmedia.com/?p=334</guid>
		<description><![CDATA[At PixelMEDIA, we’re starting to see more of our clients inquiring about how to get started on the mobile web. I thought I’d share some of the lessons we’ve learned. These are five things to keep in mind when starting &#8230; <a href="http://www.pixelmedia.com/blog/5-mobile-web-pointers/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>At PixelMEDIA, we’re starting to see more of our clients inquiring about how to get started on the mobile web. I thought I’d share some of the lessons we’ve learned. These are five things to keep in mind when starting a new mobile project.</p>
<h4>1) Decide which content to put on your mobile site</h4>
<p>One of the first challenges when starting a new mobile project is deciding exactly what content to offer your mobile visitors. There are a few differing opinions in the industry right now; some people strongly believe in the <a href="http://www.w3.org/TR/mobile-bp/#OneWeb" target="_blank">One Web</a>, while others believe that the experience should be re-shaped for the medium. This could mean a new website, new content, and a new information architecture as well as a design optimized for mobile.</p>
<p><span id="more-334"></span></p>
<h4>2) Mobile enabling your site isn’t as simple as adding a new stylesheet.</h4>
<p>CSS, the language used for applying styles to your website, currently provides a <a href="http://www.w3.org/TR/CSS2/media.html" target="_blank">method for specifying where those styles should be applied</a>. This functionality is provided in the form of a &#8216;media&#8217; attribute applied to your stylesheets. Supported media types include screen (your computer), print (for printing a web page), and handheld (small screen, handheld devices). Unfortunately, <a href="http://quirksmode.org/m/table.html#link9" target="_blank">support for the handheld media type</a> is limited and buggy. If it were, it would theoretically be as easy to reformat your website for a mobile device as it is to reformat it for print. There would of course still be other considerations—hiding a large banner image via CSS will not stop it from being downloaded over a slow connection to a mobile device.</p>
<p>Because of the lackluster support for the handheld media type, we&#8217;re generally stuck with device detection: if a user hits the site from a handheld device, we route them to a separate mobile website. Websites built for mobile use a very similar markup language as regular websites. However, just like some desktop browsers offer different levels of standards support, so do mobile browsers—and there are a lot more of them!</p>
<h4>3) Understand the different levels of mobile browsing</h4>
<p>At least here in the U.S., we are just starting to see a big push toward phones that are really optimized for browsing the web. With devices like the <a href="http://www.apple.com/iphone/" target="_blank">Apple iPhone</a>, <a href="http://www.samsungmobileusa.com/Instinct.aspx" target="_blank">Samsung Instinct</a>, <a href="http://www.lgmobilephones.com/phone.aspx?id=8712" target="_blank">LG Dare</a>, and the <a href="http://www.htc.com/www/product/g1/overview.html" target="_blank">G1</a>, every major wireless carrier now offers a decent phone for web browsing. While the iPhone (with its bundled version of the Safari web browser) is easily the winner for web browsing, the other devices aren&#8217;t far behind. All the major browser makers also have versions of their browsers that run on mobile devices.</p>
<p>However, there are still a lot of older phones in use whose browsing experience is basic, at best. Even popular devices like the BlackBerry tend to have a sub-standard browser compared to the devices listed above. It&#8217;s definitely a challenge to optimize your site to work on the small screens and bad browsers of the older devices, while trying to take advantage of the bigger screens and better rendering ability of newer devices.</p>
<h4>4) Play to the strengths of the platform!</h4>
<p>So, this should be fairly obvious—it&#8217;s a mobile device! Build a site that supports what a user needs to do when they&#8217;re on the go. Things like making telephone numbers into hyperlinks that automatically dial the phone can make all the difference to a user. Limiting content to what&#8217;s really important and removing images for faster page load times might be painful at first, but as you strip down to the essentials,  you&#8217;ll start increasing the usability and value of your mobile site.</p>
<h4>5) Test on a range of devices</h4>
<p>Testing is definitely one of the bigger challenges we have to deal with. There is simply no way to test on every device. However, with the right combination of devices you can get a great idea of how your site will perform across a wide range of different devices. On page 62 of Cameron Moll&#8217;s book, <a href="http://umbrellatoday.com/locations/235237131/forecast" target="_blank">Mobile Web Design</a>, Joe Shepter explains how Yahoo! employed this technique when developing a new mobile site for FIFA.</p>
<blockquote><p>To make sense of the chaos, Yahoo!&#8217;s team first selected a target<br />
group of ten phones. They were all widely distributed, and their<br />
browsers ran the gamut from high-end to barely functional. As the<br />
thinking went, if the site worked perfectly on all of them, it would<br />
perform reasonably well on the rest of the world&#8217;s phones.<br />
<cite>- Joe Shepter</cite></p></blockquote>
<p>The folks at MobiForge recommend <a href="http://mobiforge.com/book/export/html/373#node-375" target="_blank">a similar process</a>:</p>
<blockquote><p>One way to approach this problem is to focus on five classes of devices that span a range of capabilities. Of the hundreds of devices available, supporting five mainstream devices makes a great place to start. Obviously supporting more devices ensures greater compatibility with more devices and developers should always endeavor to do this, but supporting five devices disparate devices can do the job.</p></blockquote>
<p>There are also <a href="http://mobiforge.com/page/mobile-emulators" target="_blank">plenty of emulators</a> to help you along, but are definitely not a substitute for the real thing.</p>
<h4>6) Use the resources available to you!</h4>
<p>Ok, so I know I said 5 pointers, but everyone likes that last extra freebie, right? One last thing to keep in mind—there are resources available to help you along. Aside from the emulators to help with testing (which can be much quicker to use when still in development), there are some web sites that will help check your website to see if it&#8217;s ready for prime time.</p>
<ul>
<li><a href="http://validator.w3.org/mobile/" target="_blank">W3C mobileOK validator</a>: Similar to their HTML validator, but results are specific to mobile sites</li>
<li><a href="http://ready.mobi/launch.jsp?locale=en_EN" target="_blank">ready.mobi</a>: &#8220;evaluates mobile-readiness using industry best practices &amp; standards&#8221;</li>
</ul>
<p>And of course, partnering with a company who&#8217;s been through it couldn&#8217;t hurt either. We&#8217;d love to answer your questions if you&#8217;re thinking it&#8217;s time to make the leap into mobile for yourself. <a href="http://www.pixelmedia.com/contact/index.aspx" target="_self">Contact us and let&#8217;s talk about it!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pixelmedia.com/blog/5-mobile-web-pointers/feed/</wfw:commentRss>
		<slash:comments>0</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>

