jCarousel Lite – A jQuery plugin

jcarousellite-img-02

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. You can download jQuery here and jCarouselLite here. If you like interesting effects, include the Easing plugin as well (Optional). You may also want to use a compatibility easing plugin if you want to use old easing names. 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/jquery.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">&laquo;</button>
<button class="next">&raquo;</button>

<div class="any-class">
    <ul>
        <li><img src="image/1.jpg" style="width:150px; height:118px;"></li>
        <li><img src="image/2.jpg" style="width:150px; height:118px;"></li>
        <li><img src="image/3.jpg" style="width:150px; height:118px;"></li>
        <li><img src="image/4.jpg" style="width:150px; height:118px;"></li>
        <li><img src="image/5.jpg" style="width:150px; height:118px;"></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() {
    $(".any-class").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev"
    });
});

If you have any comments/suggestions/requests, feel free to drop in a comment or reach @ganeshmax in twitter.

 

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.

Ganeshji Marwaha

I spend my days as the Director of Technology for Mobility practice and help my clients design enterprise and consumer mobile strategies. Mobile Payments, Digital Wallet and Tokenization technologies are my areas of specialization

  • code to make the carousel stop at the precise moment I mouse-over it.

  • When I used the vertical scroll, the carousel was out of sync by a couple of pixels each time it rotates in IE 7.

    I put a workaround on my site. You can find it here
    http://marcellscarlett.com/post/2010/02/11/jCarousellite-in-IE-7.aspx

  • m.g.

    after a few hours of struggle I managed to pull something off. I think it’s quite nice now, you can see the results of my work here: http://e-ast.ro/ .

  • Hello, I have used jcarousel-lite in my portfolio website found here: http://bradcoker.co.uk

    I’m using the external controls with btnGo. I was wondering if anyone could point me in the right direction on how to highlight the current button corresponding to the current image?

    Thank you!

  • Hi,

    I appreciate all your hard work and thought I’d share a quick fix I made. I was having trouble with nested lists – IE: having a as part of the content inside the jCarousel unordered list. In short, your script was using them all as part its rotation.

    I was able to fix it by just changing your original variable definitions. The easiest way to explain was type it up on my blog under jCarouselLite Nested Lists.

    Hope it is of assistance!

  • Dave

    Is there a way to stop the animation after a configurable number of cycles?

  • Anand

    Hi,

    I am trying to develop a Joomla Image Scroller Module using your jCarousel Lite plugin. Somehow the plugin works fine independently but on Joomla the images are not getting rendered.

    Can you guide me on the same ??

  • syava

    Script has some bugs with content that contains HTML list tags (like ul, li, ol etc).
    Fix:

    replace
    1. “var div = $(this), ul = $(“ul”, div), tLi = $(“li”, ul), tl = tLi.size(), v = o.visible;”
    2. “var li = $(“li”, ul), itemLength = li.size(), curr = o.start;”

    with
    1. “var div = $(this), ul = $(this).children(“ul”), tLi = $(ul).children(“li”), tl = tLi.size(), v = o.visible;”
    2. “var li = $(ul).children(“li”), itemLength = li.size(), curr = o.start;”

    I tried to use “btnGo” navigation tool to scroll to some element. So, my script looks like:

    $(function() {
    var control = [];
    control[0] = ‘.slider_control .r1’;
    control[4] = ‘.slider_control .r2’;
    control[8] = ‘.slider_control .r3’;
    control[12] = ‘.slider_control .r4’;
    control[16] = ‘.slider_control .r5’;
    control[23] = ‘.slider_control .r6’;
    $(“.cat_slider”).jCarouselLite({
    btnNext: “#m_right”,
    btnPrev: “#m_left”,
    visible: 4,
    btnGo: control
    });
    });

    It didnt work fine.

    fix:
    if(o.btnGo)
    $.each(o.btnGo, function(i, val) {
    if ( val != undefined)
    {
    $(val).click(function() {
    return go(o.circular ? o.visible+i : i);
    });
    }
    });

    If you want to scroll to any position after document will be loaded, just add this code.
    ( “scrollTo” is new plugin attribute that points to element index )

    if ( o.scrollTo )
    go(o.circular ? o.visible+o.scrollTo : o.scrollTo);

  • Actron

    In the examples the space above the images is 10px hight, but the space below is 15px high. I did not manage to make both 10px heigh, even though I put it in the CSS file (margin/bottom).

    Does the jCarousel script itself change the values, too?

  • Actron

    BTW: I’m using Opera 10.10, IE 6 seems to be 10px each.

  • Marc

    Hi.
    I’m trying to use your script for my futur website but i have some errors.
    http://saloperie.fr/marc3/photo.php
    I can use the prev button but the next button don’t work.
    When i click on the next button all the pics are hidden
    The circular option is enable.

    Any idea ?

  • pablo

    is there any way to load images on demand? with ajax or something?

  • larsen

    Dear Ganeshji,

    thanks a lot for this really neat price of code.

    I am searching for a way to display the images in rows and colums.
    Someone managed to implement this feature but i can’t reproduce this.
    i.e. http://markmail.org/message/4gkiymtmzpjo5yrn#query:jcarousel%20multiple%20rows+page:1+mid:f66lffuehaihq7ou+state:results

    Can you, or someone else post the fully edited jCarousel Lite Script?

    Thanks, larsen

  • Adam

    Hi Ganeshji,

    Thank you very much for the plugin! I am trying to get the carousel to stop auto sliding on the last image in the list. I tried to do this by changing, “afterEnd: null” to, “afterEnd: stop” but it is stopping on the second image (and there are four in the list). Any ideas? Thanks again!

  • I would like to to state that an experienced essay writing service can be a good assistant on the way of term paper titles accomplishing. Hence, all students can use it anytime they would like to buy essays.

  • Jon

    @Mark #477: I think you forgot to mention something, as I was having problems incorporating your changes until I found out.

    You need to edit the width function, to send the correct variables to the modified css function.

    P.S. i’m editing the original version, not minified.

    so my code looks like:

    function css(el, prop) {
    //return parseInt($.css(el[0], prop)) || 0; //original
    return parseInt($.css(el, prop)) || 0;
    };

    function width(el) {
    //return el[0].offsetWidth + css(el, ‘marginLeft’) + css(el, ‘marginRight’);//original
    return el[0].offsetWidth + css(el[0], ‘marginLeft’) + css(el[0], ‘marginRight’);
    };

    function height(el) {
    //return el[0].offsetHeight + css(el, ‘marginTop’) + css(el, ‘marginBottom’); original
    var z = 0;
    for (y = 0; y z) z = x;
    }
    return z;
    };

  • Jon

    last function was edited out.

    for (y = 0; y z) z = x;
    }

  • abhi

    Can you help me when mouse over animation must stop and when mouseout it must resume the animation. Thanks in advance.

  • somnath

    Hi ,

    You are doing great work .
    Just tell me .If I mouseover prev button then it should continuously displaying prev images and stops auto functions same with next button.please tell me how can I achieve this .

    Thank You
    Somnath S

  • Rosuta

    I like the the jCarouselLite.

    There is one thing that looks strange – the size of list and indexes of its items.

    I’ve got list of 8 thumbnails, but when I ask for the list size with ‘$(“.carousel .thumbnails li”).size()’, it returns 16.
    In function called on click I save current index to global variable – currentIndex = $(“.carousel .thumbnails img”).index(this) – it seemss that the first thumbnail has index 0 when the page loads but when I click on it second time, it has index 4 …

    What I’m trying to do is to do is to switch to next/previous item in list by clicking on right/left side of big image (carousel contains thumbnails). Is it some easy way how to “click” on next/prev item in list ?

  • Great carousel !

    Maybe I have found a little bug : in a non-circular carousel with 10 items, the two last items are not visible and the carousel is stopping at the 8th item.

    My parameters :
    btnPrev: ‘#carousel .btn.previous a’,
    btnNext: ‘#carousel .btn.next a’,
    circular: false,
    visible: 4,
    start: 0,
    scroll: 4

    Thank you

    PS: It would be relevant to dispatch an event when a non-circular carousel is at the first and at the last items and when the carousel is leaving them.

  • It’s working for me in changing this code :

    } else { // If non-circular and to points to first or last, we just return.
    if(toitemLength-v) return;
    else curr = to;
    } // If neither overrides it, the curr will still be “to” and we can proceed.

    to this code :

    } else { // If non-circular and to points to first or last, we just return.
    if(to == itemLength-v) return;
    else if(to>itemLength-v) curr = itemLength-v;
    else if(to<0) curr = 0;
    else curr = to;
    } // If neither overrides it, the curr will still be "to" and we can proceed.

    But I don't if bugs will appear in other configurations…

  • It’s better with this code :

    /*
    // original
    if(toitemLength-v) return;
    else curr = to;
    */

    // fix
    if(to == 0 || to == itemLength-v) return;
    else if(to>itemLength-v) curr = itemLength-v;
    else if(to<0) curr = 0;
    else curr = to;

    and (for the disabled class management) :

    /*
    // original
    $(o.btnPrev + "," + o.btnNext).removeClass("disabled");
    $( (curr-o.scroll itemLength-v && o.btnNext)
    ||
    []
    ).addClass(“disabled”);
    */

    // fix
    $(o.btnPrev + “,” + o.btnNext).removeClass(“disabled”);
    $( (curr == 0 && o.btnPrev)
    ||
    (curr >= itemLength-v && o.btnNext)
    ||
    []
    ).addClass(“disabled”);

    And it works perfectly with my parameters… Forget the event dispatching I have told, I haven’t seen the “disabled” class on the buttons (is this in the documentation ?)

  • Hey man, this plugin seems great. I’m trying to reduce the number of scripts I include on my site and this seems like it will replace 3 other jquery plugins I was using.

    I will need to use the ‘external controls’ features and I think I have it figured out but wanted to let you know that the documentation about it in the demo is kind of confusing. In the demo page for External Controls you just say ” Buttons, buttons and more buttons. Feel free… “. This is cute and all but the example code isn’t that obvious, and I think it would be better if you gave a brief description of how it works and what the contents of the btnGo parameter mean. I looked at the parameter documentation and that explained it okay but it would be nice if the demo also had the explanation.

    Anyway, I love the humor in your other demos, so don’t think I’m saying it should be too serious, just that that particular one could handle some extra data ๐Ÿ™‚

    Thanks for making the plugin!

  • I have posted a comment here:

    https://forum.jquery.com/topic/jcarousellite-inner-content-functions-not-working

    Basically I am calling a lightview on items inside the carousel, but items that are not visible, IE items I have to scroll to do not work. The lightview links doesn’t work on them?

    Any ideas?

  • Mark

    $.getJSON(url,
    Hi,

    I am retrieving the image data using ajax/json.

    function(data) {
    $.each(data, function(i, item) {
    $(“#carousel ul”).append(““);
    });
    });

    I am returning a random 10 images from a database and then adding to the carousel (see below). This all works fine. However I also have another button to load another 10 images in, if i click this which clears the current li elements, loads 10 more and then calls the $(“#carousel”).jCarouselLite({}); method again the previous/next buttons go a bit nuts. I am thinking I need to “unhook” the carousel before calling this method? any ideas?

  • A triathlon is divided into three components: swimming, cycling and running. This can be daunting for novices and those trying a triathlon for the first time. Novice triathlon training should focus on learning how mixing these three separate sports have an effect on your body.

  • First, this is a fantastic plugin. Very much appreciated.

    One question. Is there a way to hard code a button/link on the page that would force the carousel to move to a precise image. For example, I want to create a button named “Go to 4” that when clicked will move the carousel so that the Fourth image is the first one showing. But…I don’t want buttons for 1,2,3,5,6,7,8,etc….just one button to move the carousel to the fourth image.

    Help would be appreciated.

  • Ganesh. I think I have found a major bug in the carousel. When I have many images in the carousel and I set the scroll option. The scrolling does not seem to work. Take a look:

    http://www.leonamarant.com/demos/portfolio/jCarTest/

    In my example, I have 10 images. The “visible” option is set to 8 and the “scroll” option is set to 7. Every time you hit the forward button, it always goes to the 8th spot. Every time.

    This is the only bug I have identified. I am working on correcting the bug in the source code but any advice, or a fix from you would be key. Thanks.

  • Crazylegsmurphy

    Hello,

    Awesome code sir! I just spent no word of a lie about 5 hours trying to get another persons code going and when I came across yours I was up and running within minutes.

    I just have one question that would make this perfect.

    Is it possible for the gallery to start at the last photo and work backwards?

    I am creating a comic viewer and I would like my audience to see the latest page first and work backward.

    As well, is there an easy way to make a “jump to start/end” button?

    Thanks and I really appreciate all the hard work.

    CLM

  • Crazylegsmurphy

    P.S. I realize there is a “start” option, but I was hoping there was a way it could look for the newest image and start there without me having to manually change that number every time.

    Regards,

    CLM

  • Zoran

    Hi! Amazing plugin!

    However, I run to a big problem and don’t know how to solve it. I’m pulling dinamically images from database with php and so create array (li array) … the problem is when one image is wider than other, carousel will display the same width. Any help!? Thanx!

  • Chris

    Hi there!

    Really a great plugin, but is it possible to add it more than once on a page? Think the buttons for the slide will slide all of them ๐Ÿ™

    I use this plugin on a ASP.net page and i generate the JavaScript Snippet to set the settings dynamically. Its very nice to just add objekts and build a slider with many different content elements! ๐Ÿ™‚

    Shall i always add a new JavaScript function to stear this slider or is there a way to not control all of the plugin once on a page?

    With regards,
    Chris M.

  • Phil

    This is a really nice plugin. I had to make the amends suggested by hpirator to make the non-circular carousel work and to fix the ‘disabled’ class addition.

    Can I suggest that these are added to the trunk?

    I also had to tweak the code to make the ‘previous’ link disabled on init

    // original
    if(o.btnPrev)
    $(o.btnPrev).click(function() {
    return go(curr-o.scroll);
    });

    // fix
    if(o.btnPrev) {
    $(o.btnPrev).click(function() {
    return go(curr-o.scroll);
    });
    if (o.start==0)
    $(o.btnPrev).addClass(‘disabled’);
    }

    Also have a couple of other minor semantic suggestions:
    1. Why the need for the non-semantic div in the original markup? Can a wrapper not be added via jQuery?
    2. It doesn’t seem possible to use dynamically created prev and next links. Would this just be a case of changing .click(function(){}) to .live(‘click’,function(){}) ? That didn’t seem to work for me either

  • I needed to show the number of items (li) in my carousel : maybe could help somebody later…

    In your div carousel, create a div with an id ().

    In your carousel’s declaration, add the param “howmany: id” with your new div’s id.
    Example:
    $(function() {
    $(“.anyClass”).jCarouselLite({
    howmany: “count”,
    btnNext: “.next”,
    btnPrev: “.prev”
    });
    });

    Before the function vis(), add this:

    function howmany(id) {
    if(document.getElementById(id))
    document.getElementById(id).innerHTML =tl+” item”+(tl>1?’s’:”);
    };
    if(o.howmany)
    howmany(o.howmany);

    Thanx to Ganeshmax for his great script.

  • Sorry, the filter eat my text.

    In your div carousel, create a div with an id ([div id=’count’][div]).

    Please replace “[” and “]” by “less than” and “more than”.

  • Linsky

    I user jCarousel Lite in my school project.now i want change the autoscroll direction,what can i do ?
    thanks!

  • tekolehm

    maven-minify-plugin is unable to minify your JavaScript using YUI compressor, there is a bug in JCarouselLite:

    http://code.google.com/p/maven-samaxes-plugin/issues/detail?id=12

    Could you please fix this?

  • Hi, Ganesh!
    I’m using your plugin at a page http://www.chikhacheva.com/pos.html and have a problem in Chrome and Safari browsers: There is a space after with carousel and I don’t have an idea how to remove it. If you know, what I should correct in the script to remove the space, please write to me.

  • Hi, Ganesh!
    I’m using your plugin at a page http://www.chikhacheva.com/pos.html and have a problem in Chrome and Safari browsers: There is a space after <> with carousel and I don’t have an idea how to remove it. If you know, what I should correct in the script to remove the space, please write to me.

  • For anyone having problems in IE7/6 with vertical lists being a few pixels off on scroll, this is caused by IE7/6’s poor rendering. The fix that worked for me was to take the out of the flow and set it to a width of 100%. Someone previously suggested a javascript fix but a pure CSS solution is much better.

    .vertical-news li.item{
    width:100% !important;
    float:left !important;
    }

  • Sam Bindoff

    Hi,

    I think i’ve found a bug in the carousel. When you start from anything other than 0 and have circular set to true the carousel has trouble when using the previous button. In my example I have 6 images and set it up like this:

    $(“#expCarousel .carouselcontent”).jCarouselLite({
    btnNext: “#expCarousel .next”,
    btnPrev: “#expCarousel .prev”,
    speed: 500,
    visible: 1,
    start: 3,
    scroll: 1
    });

    Line 293: if(to<=o.start-v-1) { // If first, then goto last
    Line 293: if(to<=4-1-1) { // If first, then goto last (example variables, fyi: Line 233 adds visible onto start)

    Using my example the if statement gets triggered when variable 'to' is 2 or less instead of -1 (the prepended 1st element) or less.

    Am i right in thinking that if i was to change the if statement to check whether variable 'to' is less than 0 this would work?

    Line 293: if(to<0) { // If first, then goto last

    I haven't come across this not working yet.

    Cheers
    Sam

  • I have faced the same problem as faced by Dave(Post No. 757) viz. “Is there a way to stop the animation after a configurable number of cycles?” but found no solution in replies to this post.

    Finally I modified the plugin to accept the no. of cycles to animate and after than it stops animating. I wanted to submit my changes as a patch for this plugin. Please let me know how I can contribute?

    Thanks
    Bhagwat
    bhagwat(at)intelligrape(dot)com

  • Lowell

    I patched your plugin to prevent it from scroll while it is being hovered. I only changed a few lines. Email me if you want me to send you my changes.

    Lowell

  • minutiae

    Hi, great plugin. One bug I’ve noticed across all modern browsers is when scroll is set to 3, and 16 items are used, the third item is dropped from the list when you “next” through the whole list one or more times. I assume this has to do w/ 16 not being divisible by 3 as the last group is items 16,1,2 then 4,5,6. Strange thing is clicking the previous button brings it back.

  • Great Post,

    I use jCarousel Lite in my school project.

    Thank to share.

  • Jon

    How do you auto scroll the images horizontally from left to right… instead of right to left?

  • sam

    fixed a bug and support auto-scroll amount set:
    ————————————————
    (function($) { // Compliant with jquery.noConflict()
    $.fn.jCarouselLite = function(o) {
    o = $.extend({
    btnPrev: null,
    btnNext: null,
    btnGo: null,
    mouseWheel: false,
    auto: null,
    autoScroll:1,

    speed: 200,
    easing: null,

    vertical: false,
    circular: true,
    visible: 3,
    start: 0,
    scroll: 1,

    beforeStart: null,
    afterEnd: null
    }, o || {});

    return this.each(function() { // Returns the element collection. Chainable.

    var running = false, animCss=o.vertical?”top”:”left”, sizeCss=o.vertical?”height”:”width”;
    var div = $(this), ul = $(“ul”, div), tLi = $(“li”, ul), tl = tLi.size(), v = o.visible;

    if(o.circular) {
    ul.prepend(tLi.slice(tl-v-1+1).clone())
    .append(tLi.slice(0,v).clone());
    o.start += v;
    }

    var li = $(“li”, ul), itemLength = li.size(), curr = o.start;
    div.css(“visibility”, “visible”);

    li.css({overflow: “hidden”, float: o.vertical ? “none” : “left”});
    ul.css({margin: “0”, padding: “0”, position: “relative”, “list-style-type”: “none”, “z-index”: “1”});
    div.css({overflow: “hidden”, position: “relative”, “z-index”: “2”, left: “0px”});

    var liSize = o.vertical ? height(li) : width(li); // Full li size(incl margin)-Used for animation
    var ulSize = liSize * itemLength; // size of full ul(total length, not just for the visible items)
    var divSize = liSize * v; // size of entire div(total length for just the visible items)

    li.css({width: li.width(), height: li.height()});
    ul.css(sizeCss, ulSize+”px”).css(animCss, -(curr*liSize));

    div.css(sizeCss, divSize+”px”); // Width of the DIV. length of visible images

    if(o.btnPrev)
    $(o.btnPrev).click(function() {
    return go(curr-o.scroll);
    });

    if(o.btnNext)
    $(o.btnNext).click(function() {
    return go(curr+o.scroll);
    });

    if(o.btnGo)
    $.each(o.btnGo, function(i, val) {
    $(val).click(function() {
    return go(o.circular ? o.visible+i : i);
    });
    });

    if(o.mouseWheel && div.mousewheel)
    div.mousewheel(function(e, d) {
    return d>0 ? go(curr-o.scroll) : go(curr+o.scroll);
    });

    var hAuto=null;
    if(o.auto)
    hAuto = setInterval(function() {
    go(curr+o.autoScroll,true);
    }, o.auto+o.speed);

    function vis() {
    return li.slice(curr).slice(0,v);
    };

    function showmsg(to,useAuto,color){
    var s=$(“#msg”).html();
    s+= “”;
    s+= “to=” + to + ” “;
    s+= “useAuto=” + useAuto + ” “;
    s+= “itemLength=” + itemLength + ” “;
    s+= “liSize=” + liSize + ” “;
    s+= “o.start=” + o.start + ” “;
    s+= “v=” + v + ” “;
    s+= “curr=” + curr + ” “;

    s+= “”;
    if(color==”red”)s+=””;
    $(“#msg”).html(s + “”);
    }

    function go(to,useAuto) {
    if(!running) {

    if(o.beforeStart)
    o.beforeStart.call(this, vis());

    if(hAuto)clearInterval(hAuto);

    if(o.circular) { // If circular we are in first or last, then goto the other end
    if(to=itemLength-v+1) { // If last, then goto first
    ul.css(animCss, -( Math.abs(curr-(itemLength-v*2)) * liSize ) + “px” );
    curr = to-(itemLength-v*2);

    showmsg(to,””,”black”);
    } else curr = to;
    } else { // If non-circular and to points to first or last, we just return.
    if(toitemLength-v) return;
    else curr = to;
    } // If neither overrides it, the curr will still be “to” and we can proceed.

    running = true;

    ul.animate(
    animCss == “left” ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing,
    function() {
    if(o.afterEnd)
    o.afterEnd.call(this, vis());
    if(o.auto)
    hAuto = setInterval(function() {
    go(curr+o.autoScroll,true);
    }, o.auto+o.speed);
    running = false;
    }
    );
    // Disable buttons when the carousel reaches the last/first, and enable when not
    if(!o.circular) {
    $(o.btnPrev + “,” + o.btnNext).removeClass(“disabled”);
    $( (curr-o.scroll itemLength-v && o.btnNext)
    ||
    []
    ).addClass(“disabled”);
    }

    }
    return false;
    };
    });
    };

    function css(el, prop) {
    return parseInt($.css(el[0], prop)) || 0;
    };
    function width(el) {
    return el[0].offsetWidth + css(el, ‘marginLeft’) + css(el, ‘marginRight’);
    };
    function height(el) {
    return el[0].offsetHeight + css(el, ‘marginTop’) + css(el, ‘marginBottom’);
    };

    })(jQuery);

  • sam

    Sorry!
    Please delete debug function “showmsg” above.

  • Oscar

    Hey, great plugin!

    I’m trying to put several carousels on the same page (actually i’m using it in posts on my WordPress blog) but when I do clicking any “next-button” or “prev-button” changes images on _all_ carousels.

    Am I missing something obvious? Is there a way to link next and prev buttons to a certain carousel? Sorry if i’m being stupid.

    Any help greatly appreciated!