Home arrow JavaScript arrow Page 2 - Building a Slide Show with jQuery
JAVASCRIPT

Building a Slide Show with jQuery


In this first tutorial in a two-part series, I will explain how to build a basic slide show by using the Ajax module included with the increasingly popular jQuery JavaScript framework. As you'll see, the use of the handy “$.ajax()” method makes this process very simple.

Author Info:
By: Alejandro Gervasio
Rating: 4 stars4 stars4 stars4 stars4 stars / 4
October 08, 2009
TABLE OF CONTENTS:
  1. · Building a Slide Show with jQuery
  2. · Start building an Ajax-based slide show
  3. · Fetching images from the web server with Ajax
  4. · Listing the slide show's full source code

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Building a Slide Show with jQuery - Start building an Ajax-based slide show
(Page 2 of 4 )

A good way to start building this Ajax-based slide show is by creating the application's front end. Since my main goal here is for you to learn how to use the Ajax module bundled with the jQuery library, I'm going to keep all of the CSS code and structural markup reduced to a minimum.

However, I must begin showing you some functional code, so below I defined a sample (X)HTML file. It is responsible for displaying a simple container on the browser that will house the slide show's images.

Please take a look at the signature of the following file, which creates a basic front-end for this Ajax application:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Slide show using jQuery library</title>

<style type="text/css">

body{

margin: 0;

padding: 0;

background: #eee;

}

h1{

text-align: center;

font: bold 24px Arial, Helvetica, sans-serif;

color: #000;

}

#container{

text-align: center;

width: 300px;

height: 200px;

margin-left: auto;

margin-right: auto;

background: #fff;

border: 1px solid #000;

}

#container img{

border: none;

}

</style>

</head>

<body>

</body>

<h1>Slide show using jQuery library</h1>

<div id="container">

</div>

</html>

As shown above, the front-end coded previously is really very basic. Essentially it's composed of only one div, identified as "container," which will house each image of the slide show, fetched from the web server via Ajax.

Apart from providing you with the CSS code and the structural markup that comprise the front-end of the slide show, here's an image that illustrates its visual appearance:



As you can see above, the structure of the front-end looks pretty primitive, but this is an aspect that isn't really important at the moment. Though now that I've shown you how to build a simple graphical interface for displaying a sequence of images, it's time to see how to use the Ajax capabilities of jQuery to implement a fully-functional slide show.

The logic that drives this web application will be constructed around the functionality of a method of jQuery called "$.ajax()". However, to learn the full details of this process, please click on the link that appears below and read the following section.


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 7 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials