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’s 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 having it displayed below the images or as a tooltip box, you can try using the following tutorial below.
![]()
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 can be scrolled with the use of 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 takes 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 the plugin configuration, you can check out the author site.
Now, let’s start by adding 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 is 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 is 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 is 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!
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)
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 :)
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
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.
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
});
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?
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) {
?>
< img src="images/.jpg" alt="Title 1" class="captify" />
< ?php } ?>
< /ul>
< /div>
hope this helps.
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 ;)
Hi Angel,
Thank you and I'll be looking forward to see your work. :)
Hi Terrance,
Here is the result of my design customization of jCarouselLite:
http://www.balkanvegetables.eu/en/stages/detail/id/12
Hope you like it!
Hi, really cool carousel!
Any body knows how to set autostart and loop?
Tnx
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.
Yes, i've solved as you answer me.
Tank u!
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.
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
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.
Thanks for your plug in, it made my work easy
nice one thanks for this
The soluton was this: I removed the line ".css("height", li.height())" so the hight will be set to the maximum one automatically.
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!?
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
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
how to build an auto-scrolling..?
Trying to run it as auto-scrool :( what happens if you are using id instead of class?
Nice tutorial - sure to book mark - this is going to help out so much. jQuery plugin's are just fantastic!
Hi,
i really like your tutorial, it's really really really something I want to use.
I started learning things about web design this year and this is my first web page and I'm of course experiencing a lot of problems :( And I'm really hoping you or somebody else can help me.
I incorporated your gallery into my website and everything seems to work except in IE6. The images are there but they don't load completly, I tried everything and don't know what to do anymore.
Here is the link: http://metalurban.eu5.org/proizvodi/cerada/cerada.htm
Thank you very much in advance ::))))
nice tutorial i will use this in my website thanks for sharing