<?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>Halfslide Design Blog - Austin, Texas Website Design &#187; javascript</title>
	<atom:link href="http://www.halfslide.com/blog/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.halfslide.com/blog</link>
	<description>Austin, Texas Website Design</description>
	<lastBuildDate>Tue, 03 Aug 2010 19:52:29 +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>Simple Image Slideshow with jQuery and jQuery Cycle Plugin</title>
		<link>http://www.halfslide.com/blog/2009/09/16/simple-image-slideshow-with-jquery-and-jquery-cycle-plugin/</link>
		<comments>http://www.halfslide.com/blog/2009/09/16/simple-image-slideshow-with-jquery-and-jquery-cycle-plugin/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 15:31:40 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Image Slideshow]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery Cycle]]></category>

		<guid isPermaLink="false">http://www.halfslide.com/blog/?p=30</guid>
		<description><![CDATA[See The Demo
I recently completed a website design project for a local austin company that involved creating a simple image slideshow on the login page of their application. These types of slideshows have traditionally been done using an animation toolkit or framework such as Adobe&#8217;s Flash product. Starting around three years ago, I was introduced [...]]]></description>
			<content:encoded><![CDATA[<p><a class="demo" title="jQuery Image Slideshow" href="http://www.halfslide.com/sample/slideshow/" target="_blank">See The Demo</a></p>
<p>I recently completed a website design project for a local austin company that involved creating a simple image slideshow on the login page of their application. These types of slideshows have traditionally been done using an animation toolkit or framework such as Adobe&#8217;s Flash product. Starting around three years ago, I was introduced to <a title="Scriptaculous Javascript Framework" href="http://script.aculo.us/" target="_blank">script.aculo.us</a> which provided the ability to use effects with DOM elements to provide cool animations.</p>
<p>Just within the last year, I&#8217;ve started working more with jQuery and have been introduced to the slew of extremely cool plugins.  The newest one I&#8217;ve come across is <a title="jQuery Cycle" href="http://malsup.com/jquery/cycle/" target="_blank">jQuery Cycle</a>.  Using this plugin and 9 lines of javascript code, I was able to create an extremely simple but cool image slide-show for the website project for my client.</p>
<p>The first step in building the slideshow is to create the html element that will hold the images for your slideshow:</p>
<blockquote class="code"><p>&lt;div id=&#8221;slideshow&#8221;&gt;<br />
&nbsp;&nbsp;&lt;img src=&#8221;slides/slide-1.jpg&#8221; border=&#8221;0&#8243;/&gt;<br />
&nbsp;&nbsp;&lt;img src=&#8221;slides/slide-2.jpg&#8221; style=&#8221;display:none&#8221;/&gt;<br />
&nbsp;&nbsp;&lt;img src=&#8221;slides/slide-3.jpg&#8221; style=&#8221;display:none&#8221;/&gt;<br />
&lt;/div&gt;</p></blockquote>
<p>The above is a simple list of images within the div element that&#8217;s identified by the &#8220;slideshow&#8221; id.  This will enable jQuery to pick up the &#8220;slideshow&#8221; element and then iterate over the &lt;img&gt; elements within it when building the slideshow.</p>
<p>The second step is to write the actual javascript that will use the plugin to build and run the slideshow:</p>
<blockquote class="code"><p>$(document).ready(function(){<br />
&nbsp;&nbsp;$(function(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;$(&#8220;#slideshow&#8221;).cycle({<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fx: &#8216;fade&#8217;,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;speed:2500,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;timeout: 1000<br />
&nbsp;&nbsp;&nbsp;&nbsp;});<br />
&nbsp;&nbsp;});<br />
});</p></blockquote>
<p>A little explanation on what is happening here: The $(&#8220;#slideshow&#8221;) is grabbing the slideshow div element and feeding the images into jQuery Cycle Plugin&#8217;s initialization.  The plugin is applying the fade effect <a title="jQuery Cycle Effects" href="http://malsup.com/jquery/cycle/browser.html" target="_blank">(see more information on the effects you can use here)</a> at a speed of 2500 milliseconds and a timeout of 1000 milliseconds.  Speed controls how long the transition takes to complete and timeout controls the time between slide transitions.  You can find more information on the <a title="jQuery Cycle Options" href="http://malsup.com/jquery/cycle/options.html" target="_blank">options for the plugin here.</a></p>
<p>All-in-all, this has turned out to be a ridiculously easy way to code up a simple slideshow.  You can enhance your slideshow in all sorts of ways such as loading your images through ajax after the page loads, randomizing ordering, and providing new transitions.  All without having to worry about motion tweens in Flash!</p>
<p><a class="demo" title="jQuery Image Slideshow" href="http://www.halfslide.com/sample/slideshow/" target="_blank">See the Demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.halfslide.com/blog/2009/09/16/simple-image-slideshow-with-jquery-and-jquery-cycle-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
