<?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>Paul.Bagosy.Com &#187; jQuery</title>
	<atom:link href="http://paul.bagosy.com/category/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://paul.bagosy.com</link>
	<description></description>
	<lastBuildDate>Sun, 25 Jul 2010 13:42:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>jQuery Content Swapping Portfolio</title>
		<link>http://paul.bagosy.com/2009/12/13/jquery-content-swapping-portfolio/</link>
		<comments>http://paul.bagosy.com/2009/12/13/jquery-content-swapping-portfolio/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 15:15:05 +0000</pubDate>
		<dc:creator>Paul Bagosy</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://paul.bagosy.com/?p=786</guid>
		<description><![CDATA[jQuery Swapping Portfolio Here&#8217;s a demo of everything I&#8217;m about to discuss. Recently, a number of clients have asked for an complex dynamic image-gallery-like page for a few different applications like portfolios and staff directories. The CMS I work with allows me to build a complex page for the client to load up with content, [...]]]></description>
			<content:encoded><![CDATA[<!-- wp-jquery-lightbox, a WordPress plugin by ulfben --> <p>jQuery Swapping Portfolio</p>
<p><a href="/jquery_portfolio/" target="_blank">Here&#8217;s a demo of everything I&#8217;m about to discuss.</a></p>
<div class="wp-caption aligncenter" style="width: 610px"><a href="http://paul.bagosy.com/jquery_portfolio/index.htm"  target="_blank"><img title="the musical stylings of Eerwyrm will revolt you." src="http://paul.bagosy.com/jquery_portfolio/images/main_thumbnail.jpg" alt="the musical stylings of Eerwyrm will revolt you." width="600" height="215" /></a><p class="wp-caption-text">the musical stylings of Eerwyrm will revolt you.</p></div>
<p>Recently, a number of clients have asked for an complex dynamic image-gallery-like page for a few different applications like portfolios and staff directories.  The CMS I work with allows me to build a complex page for the client to load up with content, but the front end is where all the magic happens.</p>
<p>The first of these sites featured an artistic design and required a portfolio for landscape projects, so I wanted to go with an elegant flowing effect. There are two primary element to this concept:  the navigation and the content.  The content itself can be further divided to images and text, both of which are important elements for this particular layout.</p>
<p>The navigation consits of two columns of thumbnails down the side (or wherever you need them &#8211; for this example they&#8217;re on the side).  They live in a div that&#8217;s floated to the right.  Here&#8217;s what that code looks like:</p>
<p>Each thumbnail is tied to a div which is given a different ID. (link_1, link_2, etc.).  In the script, we bind each of those IDs to a click event:</p>
<pre>	$('#link_1').bind('click', {id:'1'} ,clickHandler);
	$('#link_2').bind('click', {id:'2'} ,clickHandler);
	etc.</pre>
<p>When anything in that div is clicked, it fires the click event, aptly named clickHandler:</p>
<pre>	var clickHandler = function(link){
		$('.main').fadeOut().pause(250);
		$('#content').animate({"height": $('#main_' + link.data.id).height() + 20}, {duration: "slow"});
		$('#main_' + link.data.id).pause(250).fadeIn("slow");
	}</pre>
<p>Important safety tip: That pause() function is there to slow things down so fadeouts don&#8217;t cross:</p>
<pre>	$.fn.pause = function(duration) {
	    $(this).animate({ dummy: 1 }, duration);
	    return this;
	};</pre>
<p>Now, on the content side, it&#8217;s just a matter of stacking up DIVs with your content in them and giving each div a unique (and patterned with the same id structure as your thumbnail IDs) ID (main_1, main_2, etc.).  Granted, if you&#8217;ve got a lot of data, you&#8217;re probably better off with a system to import it via AJAX, but for this instance, we&#8217;re going to cover a smaller data set.</p>
<p>So, we&#8217;ve got our sidebar:</p>
<pre>&lt;div id="sidebar"&gt;
 &lt;div id="link_1"&gt;&lt;img src="images/thumb_1.jpg" alt="" /&gt;&lt;/div&gt;
 &lt;div id="link_2"&gt;&lt;img src="images/thumb_1.jpg" alt="" /&gt;&lt;/div&gt;
&lt;/div&gt;</pre>
<p>And we have our content:</p>
<pre> &lt;div id="content"&gt;
  &lt;div id="main_1" class="content_div"&gt;Content div 1&lt;/div&gt;
  &lt;div id="main_2" class="content_div"&gt;Content div 2&lt;/div&gt;
 &lt;/div&gt;</pre>
<p>Now we just need a little styling on the content divs to hide them:</p>
<pre> .content_div { display:none; }</pre>
<p>Then it&#8217;s just a matter of displaying your first div when the page loads:</p>
<pre>	$(window).load(function(){
		$('#content').animate({"height": $('#main_1').height() + 20}, {duration: "slow"});
		$('#main_1').pause(250).fadeIn("slow");
	});</pre>
<p>The $(window).load call is important.  You don&#8217;t want this to fire right on (document).ready if there are any images in your first div, because they will likely not be completely loaded and the code won&#8217;t know how big that div is going to be.</p>
<p>so, here&#8217;s the simple code:</p>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
 &lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
  &lt;style type="text/css"&gt;
   #sidebar { width:230px; float:left; }
   #sidebar div { float:left; margin-left:5px; }
   #content { width:500px; float:left; }
   .content_div { display:none; }
  &lt;/style&gt;
  &lt;script language="javascript" type="text/javascript" src="js/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script language="javascript" type="text/javascript"&gt;
   &lt;!--
    $(document).ready(function(){

     $.fn.pause = function(duration) {
      $(this).animate({ dummy: 1 }, duration);
      return this;
     };

     var clickHandler = function(link){
      $('.content_div').fadeOut().pause(250);
      $('#content').animate({"height": $('#main_' + link.data.id).height() + 20}, {duration: "slow"});
      $('#main_' + link.data.id).pause(250).fadeIn("slow");
     }

     $(window).load(function(){
      $('#content').animate({"height": $('#main_1').height() + 20}, {duration: "slow"});
      $('#main_1').pause(250).fadeIn("slow");
     });

     $('#link_1').bind('click', {id:'1'} ,clickHandler);
     $('#link_2').bind('click', {id:'2'} ,clickHandler);
    });
   --&gt;
  &lt;/script&gt;
 &lt;/head&gt;
 &lt;body id="top"&gt;
  &lt;div id="sidebar"&gt;
   &lt;div id="link_1"&gt;&lt;img src="images/thumbnail.jpg" alt="" /&gt;&lt;/div&gt;
   &lt;div id="link_2"&gt;&lt;img src="images/thumbnail.jpg" alt="" /&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id="content"&gt;
   &lt;div id="main_1" class="content_div"&gt;Content div 1&lt;/div&gt;
   &lt;div id="main_2" class="content_div"&gt;Content div 2&lt;/div&gt;
  &lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;</pre>
<div id="crp_related"> </div>]]></content:encoded>
			<wfw:commentRss>http://paul.bagosy.com/2009/12/13/jquery-content-swapping-portfolio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Go-Live: Indian Valley Dental</title>
		<link>http://paul.bagosy.com/2009/11/25/go-live-indian-valley-dental/</link>
		<comments>http://paul.bagosy.com/2009/11/25/go-live-indian-valley-dental/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 16:56:19 +0000</pubDate>
		<dc:creator>Paul Bagosy</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[FireFox]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://paul.bagosy.com/?p=651</guid>
		<description><![CDATA[I&#8217;ve decided to start cataloging the sites that I&#8217;ve done recently, big or small. So, here we go: Indian Valley Dental What the client wanted: This was a redesign of an existing CMS site that had a lot of Flash-based elements, including the navigation. What I delivered: The design kept the header flash from the [...]]]></description>
			<content:encoded><![CDATA[<!-- wp-jquery-lightbox, a WordPress plugin by ulfben --> <p>I&#8217;ve decided to start cataloging the sites that I&#8217;ve done recently, big or small. So, here we go:</p>
<p><strong><a href="http://www.indianvalleydental.com" >Indian Valley Dental</a></strong></p>
<p><strong> </strong></p>
<p style="text-align: center"><strong><strong></p>
<div id="attachment_656" class="wp-caption aligncenter" style="width: 610px"><strong><strong><img class="size-full wp-image-656" title="Indian Valley Dental" src="http://paul.bagosy.com/wp-content/uploads/2009/11/indianvalley1.jpg" alt="Indian Valley Dental" width="600" height="400" /></strong></strong><p class="wp-caption-text">Indian Valley Dental</p></div>
<p></strong></strong></p>
<p style="text-align: left"><strong><strong>What the client wanted:</strong></strong><br />
This was a redesign of an existing CMS site that had a lot of Flash-based elements, including the navigation.</p>
<p style="text-align: left"><strong>What I delivered:</strong><br />
The design kept the header flash from the old site, and I brought over the little Flash page title flourish.</p>
<p>I reworked the existing CMS to provide data is much more search-engine friendly and a lot more streamlined.  The header navigation uses a CSS hover effect with a jQuery dropdown.  The bottom navigation uses a quick server-side element to generate a style that underlines the page that you&#8217;re currently on, and the Contact Us page uses jQuery form validation and an AJAX spam-catcher.</p>
<p>The site is identical in IE 6, 7 and 8, Firefox 3, Chrome 3, Safari 4PB and Opera 10 (aside from a few form elements that resist styling).</p>
<p>Simple from the ground up, but that&#8217;s the way I like them.</p>
<div id="crp_related"> </div>]]></content:encoded>
			<wfw:commentRss>http://paul.bagosy.com/2009/11/25/go-live-indian-valley-dental/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
