<?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>redirect_to :hack &#187; jQuery</title>
	<atom:link href="http://blog.coderubik.com/category/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.coderubik.com</link>
	<description>Thoughts on Ruby on Rails and Facebook development</description>
	<lastBuildDate>Thu, 07 Apr 2011 21:49:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Alternate background colors with jQuery</title>
		<link>http://blog.coderubik.com/2008/09/alternate-background-colors-with-jquery/</link>
		<comments>http://blog.coderubik.com/2008/09/alternate-background-colors-with-jquery/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 04:09:00 +0000</pubDate>
		<dc:creator>Pierre Olivier Martel</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://modelix.net/?p=7</guid>
		<description><![CDATA[I did a little javascript function with jQuery this morning to alternate DOM elements background colors. The function takes in parameters an array of jQuery elements and an array of hexadecimal colors and changes the background color of each element with the next color in the array. It&#8217;s only a three lines function but the [...]]]></description>
			<content:encoded><![CDATA[<p>I did a little javascript function with jQuery this morning to alternate DOM elements background colors. The function takes in parameters an array of jQuery elements and an array of hexadecimal colors and changes the background color of each element with the next color in the array.</p>
<pre class="brush: jscript; title: ; notranslate">
// Alternates the background colors of the elements
// elems  - Array of jQuery DOM objects
// colors - Array of hexadecimal colors
function alternateBgColor(elems, colors) {
    elems.each( function(index) {
    var colorIndex = index % colors.length;
    $(this).css('background-color', colors[colorIndex]);
  });
}
</pre>
<p>It&#8217;s only a three lines function but the cool thing about it is that you can alternate through as many colors as you need. I&#8217;m only using two for now but this could come useful at some point! I like how everything javascript just got easier with jQuery.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.coderubik.com/2008/09/alternate-background-colors-with-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
