jCarousel Lite – A jQuery plugin August 9th, 2007
jCarousel Lite is a jQuery plugin that carries you on a carousel ride filled with images and HTML content. Put simply, you can navigate images and/or HTML in a carousel-style widget. It is super light weight, at about 2 KB in size, yet very flexible and customizable to fit most of our needs.
Did I mention that it weighs just 2 KB?
As if that wasn’t enough, the best part is yet to come… You don’t need any special css file or class name to get this to work. Include the js file. Supply the HTML markup. Then, construct the carousel with just a simple function call.
Visit the project page for more information. There you can find a lot of demos and exhaustive documentation. This blog entry is just a teaser for further exploration.
Installing and getting it to work is as trivial as following the 3 steps given below…
Step 1:
Include a reference to the jQuery library and the jCarouselLite plugin. If you like interesting effects, include the Easing plugin as well (Optional). If you would like to navigate the carousel using mouse wheel, then include the mouse-wheel plugin as well (Optional).
<script type="text/javascript" src="path/to/jquery.js"></script> <script type="text/javascript" src="path/to/jcarousellite.js"></script> <!-- Optional --> <script type="text/javascript" src="path/to/easing.js"></script> <script type="text/javascript" src="path/to/mousewheel.js"></script>
Step 2:
In your HTML file, provide the markup required by the carousel (a “div” enclosing an “ul”). You also need the navigation buttons, but these buttons need not be part of the carousel markup itself. An example follows…
<button class="prev"><<</button>
<button class="next">>></button>
<div class="anyClass">
<ul>
<li><img src="someimage" alt="" width="100" height="100" ></li>
<li><img src="someimage" alt="" width="100" height="100" ></li>
<li><img src="someimage" alt="" width="100" height="100" ></li>
<li><img src="someimage" alt="" width="100" height="100" ></li>
</ul>
</div>
Step 3:
Fire a call to the plugin and supply your navigation buttons. You just managed to architect your own carousel.
$(function() {
$(".anyClass").jCarouselLite({
btnNext: ".next",
btnPrev: ".prev"
});
});
If you have any comments/suggestions/requests, feel free to drop in a comment or you can find me lurking around the jquery mailing list.
Update
Based on popular request, jCarouselLite has been updated to support jquery 1.2.x versions. Goto the download page and download version 1.0.1 to enjoy jquery 1.2.x support. Since Firefox 3 has some issues with $(document).ready() function, try using $(window).load() instead if you face any problems. Hopefully a future version of Firefox or jQuery will fix the problem.











I made a change.
line 300:
if(toitemLength-v) return;
to:
if(to itemLength-v) curr = to = itemLength-v;
When you have 5 items and {visible:3, scroll:3}, scroll doesn’t work.
I have just migrated a site using your excellent script. Sadly though your script worked well on the original server it doesn’t work on the new.
Would this be anything to do with the current temporary URL?
All links to the scripts are correct from what I can see.
Hope you can help.
Crispin
Further to my last message here. I migrated the website to a testing server with a proper domain set up.
The script is still non functioning. I can’t think what might be effecting it.
Some clues what to look for would be appreciated.
Hello, I have enjoyed working with jCarousel Lite.
I have been having problems with my installation not being compatible with Internet Explorer 7 and below. The images drop below the next div. Do you have any suggestions that may assist me in fixing this problem?
This is a great post which tells us about the excellent plugin and css styles or HTML, this is very useful for web developer.
Can’t make this one up, and we don’t know who did it, but every year, right after 1 Jan, someone would defecate in the hallway outside the bathroom, on the carpet.
this is very useful! i will try it for my web. thanks