<?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>Erik Kallevig Web Design</title>
	<atom:link href="http://ekallevig.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ekallevig.com</link>
	<description>Usable, accessible &#38; attractive web design.</description>
	<lastBuildDate>Wed, 24 Feb 2010 03:02:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>jShowOff: a jQuery Content Rotator Plugin</title>
		<link>http://ekallevig.com/blog/2010/01/24/jshowoff-a-jquery-content-rotator-plugin/</link>
		<comments>http://ekallevig.com/blog/2010/01/24/jshowoff-a-jquery-content-rotator-plugin/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 03:13:10 +0000</pubDate>
		<dc:creator>Erik Kallevig</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ekallevig.com/?p=48</guid>
		<description><![CDATA[I&#8217;ve released my first &#8216;official&#8217; jQuery plugin called jShowOff (I know, the name&#8217;s a little silly but I wanted something unique).  It&#8217;s a simple plugin, but it serves a common need: a content rotator, often seen at the top of homepages to promote content within a site.  It&#8217;s &#8216;official&#8217; because it actually extends [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve released my first &#8216;official&#8217; jQuery plugin called <a href="/jshowoff">jShowOff</a> (I know, the name&#8217;s a little silly but I wanted something unique).  It&#8217;s a simple plugin, but it serves a common need: a content rotator, often seen at the top of homepages to promote content within a site.  It&#8217;s &#8216;official&#8217; because it actually extends the jQuery object and follows the few design patterns recommended by the jQuery team.  I started with an old slideshow script I wrote a while ago, then heavily modified it and added a number of options.  Check out the <a href="/jshowoff">demo and documentation page</a> and let me know what you think!</p>
<p style="display: none;"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script><script type="text/javascript" src="/jshowoff/jquery.jshowoff.min.js"></script></p>
<div id="features">
<div><a href="http://google.com"><img src="http://farm5.static.flickr.com/4017/4303103738_a4745a3e6d_o.jpg" alt="Shore" /></a></div>
<div><img src="http://farm5.static.flickr.com/4062/4302354579_2a16dcb3cd_o.jpg" alt="Eddie" id="eddie" />
<p><strong>HTML Slide</strong></p>
<p>Example of an HTML slide.</p>
<p>Lorem ipsum dolor sit amet, nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam.</p>
<p><a href="http://reddit.com">Learn More &#8250;</a></p>
</div>
<div><a href="http://imgur.com"><img src="http://farm5.static.flickr.com/4067/4302354517_d72d321f17_o.jpg" alt="Flower" /></a></div>
<div><a href="http://gmail.com"><img src="http://farm3.static.flickr.com/2739/4303103822_a3b23ff7f5_o.jpg" alt="Fern" /></a></div>
</div>
<p><script type="text/javascript">$(document).ready(function(){ $('#features').jshowoff(); });</script></p>
<h2>How it works</h2>
<p>Right now, it works by taking all the child &lt;div&gt;&#8217;s from the container &lt;div&gt; on which the method was invoked and storing them in an array for adding to and removing from the container.  Eventually I&#8217;ll modify this to accept any child elements of the container, but for right now, it&#8217;s just &lt;div&gt;&#8217;s.   A counter is used to keep track of the current slide and to know when the first and last slides have been reached.</p>
<p>I used the same caching mechanism as the slideshow script, which simply loads each div into an array (and subsequently into the browser&#8217;s cache).  The slideshow script had an option to set the number of items to cache ahead of time, since it dealt with long lists of photos, but I removed it here, since usage will likely only need to support a small number of items.</p>
<h2>Getting started</h2>
<p>The required markup for jShowOff is a parent <code>&lt;div&gt;</code> with one or more child <code>&lt;div&gt;</code>&#8217;s, which will be used as the &#8217;slides&#8217;. The following is a basic example:</p>
<pre>
&lt;div id="features"&gt;
&lt;div&gt;&lt;p&gt;This is a slide!&lt;/p&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://google.com"&gt;&lt;img src="http://www.google.com/intl/en_ALL/images/logo.gif" alt="Google Logo" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;script type="text/javascript"&gt;
$(document).ready(function(){ $('#features').jshowoff(); });
&lt;/script&gt;</pre>
<h2>Customize it!</h2>
<p>jShowOff currently has a few options for customization, hopefully more in the future.  Pass these settings as an object to the <code>.jshowoff()</code> method like this:</p>
<pre>$('#features').jshowoff({ speed:1500, links: false }); });</pre>
<table id="options" cellpadding="0" cellspacing="0">
<tr>
<th>Property</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
<tr>
<td>speed</td>
<td>integer</td>
<td>3000</td>
<td>Time each slide is shown in milliseconds.</td>
</tr>
<tr>
<td>changeSpeed</td>
<td>integer</td>
<td>600</td>
<td>Speed of transition in milliseconds.</td>
</tr>
<tr>
<td>controls</td>
<td>boolean</td>
<td>true</td>
<td>Whether to create &#038; display controls (Previous, Next, Play/Pause).</td>
</tr>
<tr>
<td>links</td>
<td>boolean</td>
<td>true</td>
<td>Whether to create &#038; display numeric links to each slide.</td>
</tr>
<tr>
<td>autoPlay</td>
<td>boolean</td>
<td>true</td>
<td>Whether to start playing immediately.</td>
</tr>
</table>
<p>The <a href="/jshowoff">demo</a> uses a very basic style, but I&#8217;ve purposely isolated all the generated elements with specific id&#8217;s and classes to allow users to skin it as they please.</p>
<p>There are plenty of features I&#8217;d like to add and I&#8217;ll be keeping track of them on the <a href="/jshowoff">demo page</a>, so hopefully it will grow in time.  I also used this project as an excuse to learn <a href="http://git-scm.com/">Git</a> version control in conjunction with <a href="http://github.com">GitHub</a>.  Both have been pretty easy to pick up and GitHub has some really good resources for jumping in (besides their very nice web tools). It&#8217;s not hard to see why the jQuery team is now using them.  Enough talk, now give it a try and tell me what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://ekallevig.com/blog/2010/01/24/jshowoff-a-jquery-content-rotator-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
