<?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>Spenser Baldwin &#187; jQuery</title>
	<atom:link href="http://spenserbaldwin.com/category/javascript/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://spenserbaldwin.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Thu, 02 Feb 2012 02:40:44 +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>Magento &#8211; Show Sibling Categories using jQuery</title>
		<link>http://spenserbaldwin.com/javascript/jquery/magento-show-sibling-categories-using-jquery/</link>
		<comments>http://spenserbaldwin.com/javascript/jquery/magento-show-sibling-categories-using-jquery/#comments</comments>
		<pubDate>Mon, 30 May 2011 18:22:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Category]]></category>
		<category><![CDATA[Magento]]></category>

		<guid isPermaLink="false">http://spenserbaldwin.com/?p=2443</guid>
		<description><![CDATA[<p>For a recent Magento build, we needed to create some quick functionality for user testing.  The end result was to show the children of the active category in the left navigation.  Rather than build an entire Magento module, I opted to cheat a bit with jQuery and then, if it became a full out feature, build a module.</p>
<p>The left nav Magento code was greatly simplified and appears as such within /template/navigation/left_nav.phtml:</p>

&#60;?php foreach ($this-&#62;getStoreCategories() as $_category): ?&#62;
    &#60;?php echo $this-&#62;drawItem($_category) ?&#62;
&#60;?php endforeach ?&#62;

<p>When a user lands on a top-level category page, the regular layout is created but the 2nd level children are cloned, then appended after the top-level parent Magento category, then removed.  Comments in the jQuery below:</p>

// When Cat is active, pulls siblings out to display alongside
if(  jQuery('.parent.active' , '#leftNav').length &#62; 0 ){
 ... <a href="http://spenserbaldwin.com/javascript/jquery/magento-show-sibling-categories-using-jquery/">Read More &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>For a recent Magento build, we needed to create some quick functionality for user testing.  The end result was to show the children of the active category in the left navigation.  Rather than build an entire Magento module, I opted to cheat a bit with jQuery and then, if it became a full out feature, build a module.</p>
<p>The left nav Magento code was greatly simplified and appears as such within /template/navigation/left_nav.phtml:</p>
<pre>
&lt;?php foreach ($this-&gt;getStoreCategories() as $_category): ?&gt;
    &lt;?php echo $this-&gt;drawItem($_category) ?&gt;
&lt;?php endforeach ?&gt;
</pre>
<p>When a user lands on a top-level category page, the regular layout is created but the 2nd level children are cloned, then appended after the top-level parent Magento category, then removed.  Comments in the jQuery below:</p>
<pre>
// When Cat is active, pulls siblings out to display alongside
if(  jQuery('.parent.active' , '#leftNav').length &gt; 0 ){
    // store the active, parent Magento category
    var active = jQuery('.parent.active','#leftNav').eq(0);

    // store the &lt;ul&gt; within the parent category
    var activeUl = active.children('ul');

    // store the kids within the parent category
    var activeKids = activeUl.children();

    // find out how many kids are within the parent category
    var activeCount = activeKids.length;

    // if there are more than 'none', continue
    if(activeCount &gt; 0){
        // Real power of jQuery...chaining changes
        // remove the current kids, clone them, add and remove the 'clone' and 'last' class, respectively
        newKids = activeKids.remove().clone().addClass('clone').removeClass('last');

        // then append these cloned kids after the active, parent category
        active.after(newKids);

        activeUl.remove();
    }
</pre>
<p>Dirty work but it worked well. Please remember, if you&#8217;re wanting to have this permanently, build a Magento module to keep things modular, normalized and above all, correct.</p>
]]></content:encoded>
			<wfw:commentRss>http://spenserbaldwin.com/javascript/jquery/magento-show-sibling-categories-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Show and Hide Part Tres</title>
		<link>http://spenserbaldwin.com/javascript/jquery/jquery-show-and-hide-part-tres/</link>
		<comments>http://spenserbaldwin.com/javascript/jquery/jquery-show-and-hide-part-tres/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 18:29:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://spenserbaldwin.com/?p=475</guid>
		<description><![CDATA[jQuery also affords the ability to trigger multiple events in succession using 'string succession'.  The callback is not sent any arguments, but <code>this</code> is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.]]></description>
			<content:encoded><![CDATA[<p>jQuery also affords the ability to trigger multiple events in succession using &#8216;string succession&#8217;.  The callback is not sent any arguments, but 
<pre>$(this)</pre>
<p> is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.</p>
<p>So for example we have three spans that we want to expand in succession.  I don&#8217;t know you have a greeting that you want to display at the top of every page: &#8220;We Build Websites&#8221; &#8220;We love SEO&#8221; &#8220;We&#8217;re ashamed but maybe, just a little, we really enjoy N&#8217;Sync&#8221;&#8230;I don&#8217;t know, whatever you can think of.  To do this, we would select all the spans with the &#8216;span:eq(0)&#8217; then show the first one. Once the first has been &#8216;shown&#8217;, it triggers the next function which utilizes the selector &#8216;this&#8217; to look for the &#8216;next&#8217; span and repeat the process until there are no more &#8216;next&#8217; spans. Take into account that any span in the markup will be hidden and shown&#8230;.Any span.  Here&#8217;s what the code would look like.</p>
<pre>$('span:eq(0)').show('fast', function () {
    /* use callee so don't have to name the function */
    $(this).next('span').show('fast', arguments.callee);
  });</pre>
<p><a class="large blue awesome" href="http://spenserbaldwin.com/examples/jquery-show-and-hide-3.html">Demo for Chaining and Show</a></p>
<p>All in all, these are some pretty powerful tools for setting up not only eyecandy but real usability for the end user.  How would you utilize .show, .hide and chaining to help your users?</p>
]]></content:encoded>
			<wfw:commentRss>http://spenserbaldwin.com/javascript/jquery/jquery-show-and-hide-part-tres/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Show and Hide Part Deux</title>
		<link>http://spenserbaldwin.com/javascript/jquery/jquery-show-and-hide-part-deux/</link>
		<comments>http://spenserbaldwin.com/javascript/jquery/jquery-show-and-hide-part-deux/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 18:28:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://spenserbaldwin.com/?p=463</guid>
		<description><![CDATA[Utilizing vanilla show/hide/toggle is a perfectly legitimate way to use said functions but when we start plugging in effects to the .show and .hide events, we really start to see the eye-candy that jQuery can offer.  Using the same frame that we did in my last post on <a href="http://spenserbaldwin.com/examples/jquery-show-and-hide.html">jQuery .show and .hide</a>, we'll add in a bit of eye candy to make this a cooler transition.]]></description>
			<content:encoded><![CDATA[<p>Utilizing vanilla show/hide/toggle is a perfectly legitimate way to use said functions but when we start plugging in effects to the .show and .hide events, we really start to see the eye-candy that jQuery can offer.  Using the same frame that we did in my last post on <a href="http://spenserbaldwin.com/examples/jquery-show-and-hide.html">jQuery .show and .hide</a>, we&#8217;ll add in a bit more code to make this a cooler transition.</p>
<p>The easiest effect to add on is the speed of the function. Once this duration is added, the three methods will animate the the width, height, and opacity simultaneously.  Durations can have either the string &#8216;fast&#8217; and &#8216;slow&#8217;, which represent 200 and 600 milliseconds respectively, or one can supply his/her own number. Note that when using a string, one must enclose the value in quotation marks but none for a numerical value.</p>
<pre>.show('slow') vs .hide(600)</pre>
<p><a class="large blue awesome" href="http://spenserbaldwin.com/examples/jquery-show-and-hide-2.html">Demo for Speed</a></p>
]]></content:encoded>
			<wfw:commentRss>http://spenserbaldwin.com/javascript/jquery/jquery-show-and-hide-part-deux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: Basic Show, Hide and Toggle</title>
		<link>http://spenserbaldwin.com/javascript/jquery-basic-show-and-hide-toggle/</link>
		<comments>http://spenserbaldwin.com/javascript/jquery-basic-show-and-hide-toggle/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 19:02:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://spenserbaldwin.com/?p=438</guid>
		<description><![CDATA[As you may have guessed, I'm not properly trained in the coding languages found throughout the web.  Most, if not all of my knowledge has come from reading blogs, books and asking on Twitter. With this in mind, I've decided to post a few blog entries regarding the basics of using the jQuery library.  Today, I'm going to look at two simpler functions to learn the basic syntax and use of jQuery.  These are to show() hide() and toggle().]]></description>
			<content:encoded><![CDATA[<p>As you may have guessed, I&#8217;m not properly trained in the coding languages found throughout the web.  Most, if not all of my knowledge has come from reading blogs, books and asking on Twitter. With this in mind, I&#8217;ve decided to post a few blog entries regarding the basics of using the jQuery library.  Today, I&#8217;m going to look at two simpler functions to learn the basic syntax and use of jQuery.  These are to show() hide() and toggle().</p>
<p>Show and Hide are pretty self-explanatory; when used they either reveal or remove an element from displaying.  Toggle, as I understand it, works a bit differently by revealing those that are hidden and hiding those that are revealed.  To the code.</p>
<pre>$(document).ready(function()  {
   //we'll put the new code here
});</pre>
<p>For this example, we&#8217;ll hide a sentence a bit further down the page. To select a given element, one must use the jQuery syntax of</p>
<pre>$('css-selector')</pre>
<p>Given that this sentence will be given it&#8217;s own class, we&#8217;ll refer to it as $(&#8216;div.showhidetoggle&#8217;).  To attach our selected element to the above .ready(function(){}); we must adapt the jQuery syntax to this:</p>
<pre>$(document).ready(function()  {
   $('div.showhidetoggle').hide();
});</pre>
<p>Unfortunately, the doc.ready tells this command to run on load, but given that I like all sentences to show up, we&#8217;ll move it to a button instead so that you can toggle it.  Go on and check out the:</p>
<p><a class="large blue awesome" href="http://spenserbaldwin.com/examples/show-and-hide.html">Demo</a></p>
<p>It&#8217;s a simple concept but there&#8217;s so many applications for creating truly &#8216;eye-candy&#8217; experiences.  Just check out <a href="http://spenserbaldwin.com/portfolio">my portfolio</a> to see the toggle button in action.</p>
]]></content:encoded>
			<wfw:commentRss>http://spenserbaldwin.com/javascript/jquery-basic-show-and-hide-toggle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

