jQuery jCarousel Lite With Pretty Image Captions That Appear On Rollover

Circular row of scrolling thumbnails have been very popular on the net. It's sleek yet simple. That explains why many web professionals like to use them. However, if you are thinking of a different way to show the caption of the thumbnails instead of the usual way of have it displayed below the images or as a tooltip box, you can try the following tutorial below.

jQuery Flower

In this tutorial, we will be using jQuery, a popular JavaScript framework combining "jQuery jCarousel" and "jQuery Captify Plugins" together to create a slick and cool way of showing the thumbnails and captions. Thumbnails will be scrollable with previous and next buttons and when rolling over any thumbnail, the caption or the title of the thumbnail will slide up.

First download the latest jQuery version 1.3.2. For the circular scrolling images we will be using jCarousel Lite a super light weight jQuery plugin that carries you on a carousel ride filled with images and HTML content.

As for the pretty image captions or titles that will appear on rollover of the thumbnails, we will be using jQuery Captify plugin, for full details and plugin configuration, you can check out the author site.

Now, let start by including the jQuery framework, jCarousel Lite and jQuery Captify into your HTML file.

<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jcarousellite_1.0.1.pack.js"></script>
<script type="text/javascript" src="js/captify.tiny.js"></script>

After you have included jquery-1.3.2.min.js, jcarousellite_1.0.1.pack.js, captify.tiny.js. Wrap the JavaScript below in a script tag and then place it at the head of your document,

<script type="text/javascript">
    //jCarouselLite
    $(function() {
        $(".slider").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
        visible: 5
    });
});

//Captify
$(document).ready(function(){
    $('img.captify').captify({
    // all of these options are... optional
    // speed of the mouseover effect
    speedOver: 'fast',
    // speed of the mouseout effect
    speedOut: 'normal',
    // how long to delay the hiding of the caption after mouseout (ms)
    hideDelay: 500,
    // 'fade', 'slide', 'always-on'
    animation: 'slide',
    // text/html to be placed at the beginning of every caption
    prefix: '',
    // opacity of the caption on mouse over
    opacity: '0.7',
    // the name of the CSS class to apply to the caption box
    className: 'caption-bottom',
    // position of the caption (top or bottom)
    position: 'bottom',
    // caption span % of the image
    spanWidth: '100%'
    });
});
</script>

Here are the HTML markup.

<div id="list">
<div class="prev"><img src="images/prev.jpg" alt="prev" /></div>

     <div class="slider">
     <ul>
     <li>
         <a href="#" title="Title 1"><img src="images/1.jpg" alt="Title 1" class="captify" /></a>
     </li>
     <li>
         <a href="#" title="Title 2"><img src="images/2.jpg" alt="Title 2" class="captify" /></a>
     </li>
     <li>
         <a href="#" title="Title 3"><img src="images/3.jpg" alt="Title 3" class="captify" /></a>
     </li>
     <li>
         <a href="#" title="Title 4"><img src="images/4.jpg" alt="Title 4" class="captify" /></a>
     </li>
     <li>
         <a href="#" title="Title 5"><img src="images/5.jpg" alt="Title 5" class="captify" /></a>
     </li>
     <li>
         <a href="#" title="Title 6"><img src="images/6.jpg" alt="Title 6" class="captify" /></a>
     </li>
     <li>
         <a href="#" title="Title 7"><img src="images/7.jpg" alt="Title 7" class="captify" /></a>
     </li>
     </ul>
</div>

<div class="next"><img src="images/next.jpg" alt="next" /></div>
</div>

Here are the style for jQuery jCarousel Lite.

/************************************************
JCAROUSEL LITE
************************************************/
#list {
     height:130px;
     width:880px;
     margin:30px auto;
}

.slider {
     float:left;
     left: -5000px;
     margin:15px;
     position:relative;
     visibility:hidden;
}

.slider ul {
     height:100px;
     width:600px;
}

.slider ul li {
     padding:0 20px;
}

.slider ul li img {
     cursor:pointer;
     height:100px;
     padding-top:3px;
     width:120px;
}

.prev {
     cursor:pointer;
     float:left;
     padding-top:60px;
}

.next {
     cursor:pointer;
     float:right;
     padding-top:60px;
}

And here are the style for jQuery Captify.

/************************************************
CAPTIFY CAPTION
************************************************/
.caption-top, .caption-bottom {
     background: #000000;
     color: #ffffff;
     cursor:default;
     padding:2px;
     font-size:11px;
     text-align:center;
}

.caption-top {
     border-width:0px;
}

.caption-bottom {
     border-width:0px;
}

.caption a, .caption a {
     background:#000;
     border:none;
     text-decoration:none;
     padding:2px;
}

.caption a:hover, .caption a:hover {
     background:#202020;
}

This tutorial has been tested on IE6, IE7, FireFox 3 and Safari 4.

For a clear overview and how it works, you might want to download the files to test it out too. Enjoy!

About this Author

Terrance

Terrance is a versatile Web developer and the chief editor of OXP. He enjoys creating functional websites and is particularly engrossed in all the tiny details mixed together to construct great user experiences. He always believe that every Web user deserves the best!

Share This Article

  • Stumble Upon
  • Delicious
  • Reddit
  • Facebook

23 Comments on “jQuery jCarousel Lite With Pretty Image Captions That Appear On Rollover”

  1. Brian Reavis May 7, 2009 at 11:11 am

    Nice job tying the two plugins together! It's cool to see the merger of the two :-)

    Keep it up,
    -Brian (I'm the one who made Captify)

    • Terrance May 7, 2009 at 11:23 am

      Thanks Brian for coming by oxp!

      In fact you've made Captify easy to use, so I have the chance to use it.

      Thank for the plugin :)

  2. cristina June 26, 2009 at 10:47 pm

    Hi there,
    I was wondering if there's a way to make the lateral arrow work with the mouseover instead of clicking them,
    thanx lot

  3. Angel June 30, 2009 at 7:53 am

    Hi,
    When photos are less than 3 and "visible" is set to "5" or "6", the two or one photos we have are not visible. The control arrows and the carousel block are visible but not the images. I use firebug and I see that the problem is on generated width of "ul" element, but I can't fix it.

    Have you any ideas?
    p.s. Sorry for my poor English.

    • Terrance June 30, 2009 at 9:33 am

      Hi Angel,

      In this section of the code, change current visible no. 5 to the number you want for the image to be visible.

      //jCarouselLite
      $(function() {
      $(".slider").jCarouselLite({
      btnNext: ".next",
      btnPrev: ".prev",
      visible: 5
      });

      • Angel June 30, 2009 at 4:38 pm

        The srange in my case is that if I have 3-4 images and the visible number is set ot 6 then images are visible but not if they are 1 or 2.
        I use jcarousel lite for an dinamic news galleries, and by default I set to 6 images and this is what I want. But if there is a news with 2 images as I say this images are not visible. One solution will be for every news to count images and to set diferent number of "visible" by using php.
        Any other ideas?

        • Terrance June 30, 2009 at 5:47 pm

          I does not quite understand what's your problem.

          You can try scanning the folder for the list of image then loop through the list of images, so whenever new images are added to a folder. It will automatically be included in the galleries list.

          Something like:
          < div class="slider">
          < ul>
          < ?php
          $album_dir = 'url to your folder';
          $image_names = scandir($album_dir, 1);

          foreach ($image_names as $image_name) {
          ?>

        • < a href="#" title="Title 1">
          < img src="images/.jpg" alt="Title 1" class="captify" />
        • < ?php } ?>

          < /ul>
          < /div>

          hope this helps.

  • Angel June 30, 2009 at 6:39 pm

    Hi, again

    The situation is:
    "visible:6"
    news 1 - 7 photos - ok
    news 2 - 4 photos - ok
    news 3 - 2 photos - not visible
    so for news 2 and 3 photos are less than number of visible photos set by default but in news 2 photos are visible but not for news 3. I hope now you will understand what to explane.
    This result you can see when try this 3 described cases with Download Demo, you share in this article. My last solution is to add default image(company logo) to complete number of photos to 6 if they are less.
    When the site is online I will post link here to see the result.

    p.s. by the way, nice work and thanks for your comments ;)

  • Terrance June 30, 2009 at 7:35 pm

    Hi Angel,

    Thank you and I'll be looking forward to see your work. :)

  • Gozilla July 2, 2009 at 4:11 pm

    Hi, really cool carousel!
    Any body knows how to set autostart and loop?

    Tnx

    • Terrance July 2, 2009 at 4:20 pm

      You might want to check out jCarouselLite Site.

      Under the demo section, it tells you how to customize an auto scroll and by default the jCarouselLite is running a circular loop.

      Hope this helps.

      • Gozilla July 2, 2009 at 6:12 pm

        Yes, i've solved as you answer me.
        Tank u!

        • Terrance July 2, 2009 at 9:38 pm

          You're welcome Gozilla. It's always a joy to share and help one another if possible. Meanwhile, do stay tuned for more tips and information @ OXP.

  • Stuart Kirkland October 20, 2009 at 5:32 pm

    Please can someone help me, I have tried the carousel and i seem to be having problems, it works perfectly in Firefox, But I seem to be having issues in IE7, IE6 I would appreciate if someone can help me please. The URL is

    http://daro-cane-new.dev.triad.uk.com/Furniture-Ranges/Cane-Furniture

    Stuart Kirkland

  • Roland October 30, 2009 at 3:36 pm

    Hi,
    I'm facing the problem when displaying 3 different set of pictures within the same page. Fist time is ok when js is downloaded from the server and set the dimensions for itself but if I choose another set of picture with different dimensions (under the same div id), the carousel get crazy, and only reload of the page helps.
    Can someone tell me a solution how to reset the carousel for each page load on the client (browser) side? (For the full carousel js there exist such reset solution but for the lite one.)
    Thanks,
    Roland.

  • ooty December 27, 2009 at 3:17 am

    Thanks for your plug in, it made my work easy

  • pakistani designer January 14, 2010 at 10:36 am

    nice one thanks for this

  • Roland January 14, 2010 at 6:25 pm

    The soluton was this: I removed the line ".css("height", li.height())" so the hight will be set to the maximum one automatically.

  • Sander February 16, 2010 at 9:37 pm

    Hey, great! I was wondering how I could add an other mouse-over effect to this; like an image in black and white and on mouse-over it turns to full-color!?

  • Jeff February 26, 2010 at 12:10 am

    Hi,

    How do I change the style element here as it shows up in my html.

    I need to decrease the width to 700px but that style= is not anywhere in my wordpress files or css.

    I added an element.style to the css and that did not work.

    Any help would be greatly appreciated.

    Thank you

  • Jeff February 26, 2010 at 12:12 am

    wow, guess the particular case did not show up. Basically, it is the:

    div=slider style= overflow: hidden; visibility: visible; position: relative; z-index: 2; left: 0px; width: 800px; that needs to be changed to 700px

    Thanks

  • 24design March 5, 2010 at 8:30 pm

    how to build an auto-scrolling..?

  • No Trackbacks / Pingbacks

    Leave a Reply