jQuery jCarousel Plugin

jCarousel is a jQuery plugin for controlling a list of items in horizontal or vertical order. The items, which can be static HTML content or loaded with (or without) AJAX, can be scrolled back and forth (with or without animation). Very nice for an Image Gallery for example. Source and © Jan Sorgalla.
  • Previous Resource
  • Download
  • Next Resource

Demonstration

How to setup

Before we start, we\'ll have to include the required files, that are in this case, the jQuery library, the plugin script, and two additional style sheets. A basic one for the structure, and another one for the look, also called skin:

  1. /** jQuery Inclusion **/
  2. <script type="text/javascript" src="Path_to/jQuery.js"></script>
  3. /** Plugin Inclusion **/
  4. <script type="text/javascript" src="Path_to/jquery-carousel.js"></script>
  5. /** Additional Style **/
  6. <link href="Path_to/carousel.css" rel="stylesheet" type="text/css" />
  7. <link href="Path_to/skinname.css" rel="stylesheet" type="text/css" />
The Carousel setup needs to be added in the header or in a separate js file. The easiest way to make your carousel work is to use the following declaration:
  1. <script type="text/javascript">
  2. jQuery(document).ready(function() {
  3. jQuery("#mycarousel").jcarousel();
  4. });
  5. </script>

You then create the html markup for your carousel.

It needs to be composed of an html wrap, for example a list ul, with the same id than the one you have used in the plugin declaration in the header (in our case #mycarousel).

As we\'ve mentionned at the beginning, the craousel has a special style sheet for its look, called skin. To make this style work with your carousel, you\'ll need to specify the skin name inside the class attribute of your carousel:

  1. <ul id="mycarousel" class="jcarousel-skin-name">
  2. <li>L_CAROUSEL_ITEM 1</li>
  3. <li>L_CAROUSEL_ITEM 2</li>
  4. ...
  5. </ul>

This is it. The final step consists of adding some content to your ul list. Each item of the list will in fact be a carousel item

Why not share this here:

  • Tweet this
  • Buy the author a coffee
  • Bump this
  • Digg this
  • Post this on Del.icio.us
  • Post this on StumbleUpon
  • Post this on Reddit
  • Post this on Technorati
  • Post this on Google
  • Post this on Facebook
  • Email this to a friend

You may also like:

  • A guide to Ajax Interactions with jQuery
  • jQuery LightBox Plugin
  • jQuery FancyBox Plugin
  • Form Cloning jQuery Plugin
  • How to create your own rss feed
  • YouTube video manager with PHP, MYSQL & jQuery

Posted Comments