<?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>Curtis Henson &#187; Javascript</title>
	<atom:link href="http://curtishenson.com/version7/category/code/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://curtishenson.com/version7</link>
	<description>Freelance Web Designer and Wordpress Guru</description>
	<lastBuildDate>Wed, 21 Jul 2010 15:53:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Quick Tip: Delay Page Loading with jQuery</title>
		<link>http://curtishenson.com/version7/quick-tip-delay-page-loading-with-jquery/</link>
		<comments>http://curtishenson.com/version7/quick-tip-delay-page-loading-with-jquery/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 01:15:07 +0000</pubDate>
		<dc:creator>Curtis Henson</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://curtishenson.com/?p=521</guid>
		<description><![CDATA[On a site I recently worked on I wanted to have an animation before the next page loaded. What I wanted to happen was: user clicks a link, animation plays out, page is loaded normally. It is a nice little effect, but this is probably a trick you want to use sparingly...please...use it sparingly.]]></description>
			<content:encoded><![CDATA[<p>On a site I recently worked on I wanted to have an animation before the next page loaded. What I wanted to happen was: user clicks a link, animation plays out, page is loaded normally. It is a nice little effect, but this is probably a trick you want to use sparingly&#8230;please&#8230;use it sparingly.</p>
<p>This uses the <a href="http://www.evanbot.com/article/jquery-delay-plugin/4">delay</a>, and <a href="http://gsgd.co.uk/sandbox/jquery/easing/">easing</a> plugins for jquery. The below example includes the animation just as an example.</p>
<pre name="code" class="js">
$('#link').click(function(){
        // Get the url of the link
		var toLoad = $(this).attr('href');

			// Do some stuff
			$(this).animate({
				marginRight: '50px',
				marginLeft: '-175px'
			}, 300, 'easeOutSine').animate({
				marginRight: '-38px',
				marginLeft: '-120px'
			}, 500, 'easeOutBounce');
			// Stop doing stuff

        // Wait 700ms before loading the url
		$(this).delay(700, function(){
			window.location = toLoad;
		});

        // Don't let the link do its natural thing
		return false;
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://curtishenson.com/version7/quick-tip-delay-page-loading-with-jquery/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Quick Tip: List Hover Effect with jQuery</title>
		<link>http://curtishenson.com/version7/quick-tip-list-hover-effect-with-jquery/</link>
		<comments>http://curtishenson.com/version7/quick-tip-list-hover-effect-with-jquery/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 20:52:00 +0000</pubDate>
		<dc:creator>Curtis Henson</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://curtishenson.com/?p=250</guid>
		<description><![CDATA[A while ago a user asked me how the widget hover effects were done in my Checkmate theme. Well I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago a user asked me how the widget hover effects were done in my <a href="http://curtishenson.com/checkmate/">Checkmate</a> theme. Well I&#8217;m going to tell you. It is a little black magic, a little jquery, and passing through the outer realms of probability. But I think anyone can handle it.</p>
<h3>First things last</h3>
<p>First you&#8217;ll need <a href="http://jquery.com">jQuery</a> and the <a href="http://plugins.jquery.com/project/color">color animations plugin</a>. Add these in your footer so they load last(that&#8217;s just good practice).</p>
<pre class="js" name="code">&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;/js/jquery.color.js&quot;&gt;&lt;/script&gt;</pre>
<h3>The basic markup</h3>
<p>The basic HTML for this example is something like the following.</p>
<pre class="js" name="code">&lt;div class=&quot;widget&quot;&gt;
&lt;h3&gt;Widget Title&lt;/h3&gt;
&lt;ul&gt;
       &lt;li&gt;Item One&lt;/li&gt;
       &lt;li&gt;Item Two&lt;/li&gt;
       &lt;li&gt;Item Three&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</pre>
<h3>Hover Magic</h3>
<p>Now for the code that makes the hover actually work. Don&#8217;t blink you might miss it.</p>
<pre class="js" name="code">var originalBG = $(".widget ul li").css("background-color");
  var fadeColor = "#ddd"; 

$(".widget ul li").hover( function () {
    $(this).animate( { backgroundColor:fadeColor}, 450 )
    .animate( {backgroundColor: originalBG}, 950 )
  },
  function () {}
  );
</pre>
<p>That&#8217;s it! Ok I&#8217;ll explain a bit. The first two lines are setting up some variables, this makes the code a bit cleaner but you could include the variables directly if you wanted. The first variable is the original background color set in the CSS file. The second is the background color which will fade in.</p>
<p>If you&#8217;re familiar with jQuery you&#8217;ll know the third line includes the selector(&#8220;.widget ul li&#8221;). Next is the actual animation. First the line items background color is faded to the whatever the fadeColor is set to. Next the background color is faded out to the original color <strong>before</strong> the mouse leaves. This is the effect I wanted, but if you want the color to fade out <strong>after</strong> the mouse pointer leaves then add the
<pre><code>.animate( {backgroundColor: originalBG}, 950)</code></pre>
<p> line to the second empty function like so:</p>
<pre class="js" name="code">var originalBG = $(".widget ul li").css("background-color");
var fadeColor = "#ddd"; 

$(".widget ul li").hover( function () {
    $(this).animate( { backgroundColor:fadeColor}, 450 )
  },
  function () {
    $(this).animate( {backgroundColor: originalBG}, 950 )
  }
  );</pre>
<h3>The End</h3>
<p>That is just a quicky, there are a different effects you can easily get from adding more animation, colors, and timing. But I&#8217;ll let you figure all that out.</p>
]]></content:encoded>
			<wfw:commentRss>http://curtishenson.com/version7/quick-tip-list-hover-effect-with-jquery/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Grunt Design Launches</title>
		<link>http://curtishenson.com/version7/grunt-design-launches/</link>
		<comments>http://curtishenson.com/version7/grunt-design-launches/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 19:23:01 +0000</pubDate>
		<dc:creator>Curtis Henson</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Curtis Henson]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Links]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[freelance]]></category>
		<category><![CDATA[grunt]]></category>

		<guid isPermaLink="false">http://curtishenson.com/?p=192</guid>
		<description><![CDATA[So what have I&#8217;ve been doing for the last few weeks? I&#8217;m happy to announce the launch of GRUNT at [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://curtishenson.com/wp-content/uploads/2008/08/grunt.jpg" alt="" title="grunt" width="430" height="150" class="alignnone size-full wp-image-191" /><br />
So what have I&#8217;ve been doing for the last few weeks?  I&#8217;m happy to announce the launch of <a href="http://gruntdesign.com">GRUNT</a> at gruntdesign.com.  This is my new business identity and a step forward in my freelance career.  CurtisHenson.com started out as a portfolio, and then became a blog, I recently redesigned the site to try and incorporate a portfolio but wasn&#8217;t happy with it.  So I decided to separate the man from the myth(or something like that).</p>
<p>I decided to build an identity around a logo I had done, which is pretty much ass backwards from the way most people would do it.  The gorilla was originally for a side project but now fronts the GRUNT name which I truly believe is an appropriate name and identity for me(being the megalomaniac I am).  Domain inspiration came from my friend <a href="http://blog.blinking8s.com/index.php">Will</a>, which also included several other &#8220;colorful&#8221; suggestions.</p>
<p>The website is built on what else but WordPress, backed up by jQuery and the usual suspects.  The portfolio is still going to get attention(i.e. — I need to find all that stuff), pagination and some separation.  But if I didn&#8217;t launch it, I would tinker with it for another few years.  So expect a few more features and eye candy in the future.</p>
<h3>So what about curtishenson.com?</h3>
<p>Ch-Ch-Ch-Changes.  Well just a few.  I always thought this current design was a bit busy and crowded, so I&#8217;ll be opening things up and creating white space(dark space?).  I&#8217;m also going to get rid of everything that doesn&#8217;t have to do with a blog or me.  A reorganization of content is coming which will also probably mean some more regular posting and more RSS feeds so you can tune how high the crap pushed to your RSS reader gets.</p>
<p>There is also going to be a new sub-site which is going to contain all the downloads and side projects I do and maybe even a support forum as the comments are getting a little crowded for Checkmate.</p>
<h3>New Projects</h3>
<p>Just a quick heads up on some projects.  I promise I am going to get started on Checkmate ver. 2.0, which will be light years ahead of the current version, as soon as I get some time.  I&#8217;ve also started programming a lifestream/tumblelog app in ruby on rails, so look for that in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://curtishenson.com/version7/grunt-design-launches/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Google Now Hosts Javascript Libraries</title>
		<link>http://curtishenson.com/version7/google-now-hosts-javascript-libraries/</link>
		<comments>http://curtishenson.com/version7/google-now-hosts-javascript-libraries/#comments</comments>
		<pubDate>Sat, 07 Jun 2008 17:55:55 +0000</pubDate>
		<dc:creator>Curtis Henson</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Links]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://curtishenson.com/?p=161</guid>
		<description><![CDATA[Google has released their Ajax Libraries API, and I for one welcome it.  Anything I can do to <strong>speed up websites</strong> and offload files is something I'll likely take advantage of.]]></description>
			<content:encoded><![CDATA[<p>News of <a href="http://code.google.com/apis/ajaxlibs/">Google Ajax Libraries API</a> is spreading fast, and I for one welcome it.  Anything I can do to <strong>speed up websites</strong> and offload files is something I&#8217;ll likely take advantage of.</p>
<p>They&#8217;ve recently added jQuery, and I&#8217;ve started using it with this new design.  So far it is working great, but will it last?  Anyone who uses Google Analytics knows that at times it can slow your page down.  Although Google says this is a faster alternative to using your own server, I think the chance for slow response time is still there.  </p>
<h3>The Real Benefit</h3>
<p>However, offloading the file to the <a href="http://en.wikipedia.org/wiki/Hackers_(film)">Gibsons</a> over at Google is not the main reason this is faster.  <strong>Caching is what makes this so much faster</strong>, after the initial download, the library is cached and no longer re-downloaded at every website.  For example if a user visits jQuery&#8217;s site, then visits mine, they will no longer have to wait for the jQuery library to load as it will already be cached on their computer.  Obviously this only works if people start using the service.  I imagine plenty of web 2.0 companies will start using the service, which will benefit everyone, and you should use it too.</p>
<h3>Security Risks</h3>
<p>All is not rosy though, there is some security risk when using the service.  If someone was able to hack into the service(unlikely) or someone with access was to turn evil(more likely, think postal workers) they would be able to inject javscript into your site.  This would be a flawless victory and fatality(<-- mortal kombat reference) for the hacker.  I think there is a <strong>VERY</strong> small chance of this actually happening, so the reward well exceeds that risk.</p>
<p>Another point to consider is Google will have access to data about your website it may not normally have access to.  This doesn&#8217;t bother me in the least as I worship at the Google temple, but for some the invasion may be more of a serious issue.</p>
<h3>How do I use it?</h3>
<p>Thats easy, you can either call the new script in a simple &lt;script> tag like I am currently doing.  Or use the google.load function.</p>
<p>Below is the script tag I use which calls the minified jQuery library.  The url structure is pretty straightforward: name of the library, version, and file name.  <strike>I believe using 1 as the version number gets the latest version, but I&#8217;m not 100% sure.</strike>  The structure below uses a version wild card to get the latest 1.*.* version.  I would recommend using the full version number for better  results(see Mark Lucovsky comment).</p>
<pre class="html">
&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript">&lt;/script>
</pre>
<p>The next example uses the google.load function and is straight from the Google page.</p>
<pre class="js" name="code">
&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
&lt;script&gt;
  // Load jQuery
  google.load(&quot;jquery&quot;, &quot;1&quot;);

  // on page load complete, fire off a jQuery json-p query
  // against Google web search
  google.setOnLoadCallback(function() {
    $.getJSON(&quot;http://ajax.googleapis.com/ajax/services/search/web?q=google&amp;;v=1.0&amp;;callback=?&quot;,

      // on search completion, process the results
      function (data) {
        if (data.responseDate.results &amp;&amp;
            data.responseDate.results.length&gt;0) {
          renderResults(data.responseDate.results);
        }
      });
    });
&lt;/script&gt;
</pre>
<p>For more information about the API see Google&#8217;s <a href="http://code.google.com/apis/ajaxlibs/">AJAX libraries</a> page</p>
]]></content:encoded>
			<wfw:commentRss>http://curtishenson.com/version7/google-now-hosts-javascript-libraries/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

