sorgalla.com


Updates

Digg! Posted in Javascript by Jan on December 13, 2006 at 11:50h

jCarousel is now available at version 0.1.4. As result of user requests at the mailinglist and in the comments, it accepts 2 new configuration options autoScrollResumeOnMouseout and itemStart.

Additionally, jCarousel is delivered with the brand new jQuery 1.0.4.

2 Responses to 'Updates'

Subscribe to comments with RSS or TrackBack to 'Updates'.

  1. Josh Kline said on Monday, January 1, 2007 at 22:14h

    Great plugin!
    I think I found a bug in the priv.available function, or I just don’t understand how it is supposed to work.

    I have an itemVisible:1, itemScroll:1 carousel.
    (Eventually I’ll turn on autoScroll:3 and autoScrollStopOnInteract: true, but that doesn’t effect my question)
    I am loading my images dynamically via ajax.

    My goal is to cache images so there is not an ajax call every time next is clicked. Therefor I want to add 4 images to the items array every time loadItemHandler is called with available false.

    Here is my code based on your example(I don’t know what wordpress will do to the formatting)


    function loadItemHandler(carousel, start, last, available)
    {
    console.log("loadItemHandler: " +
    carousel + ", " + start + ", " + last + ", " + available);

    if (available) {
    // Trigger loaded
    carousel.loaded();
    return;
    }

    var cr = carousel;
    var item_source = "/carousel-passthrough.asp?num=" + (4) +
    "&start=" + start;
    // notice that i've asked for 4 items from my server side script
    console.log("source url: " + item_source);

    jQuery.get(item_source, function(data) {
    appendItemCallback(cr, start, last, data);
    });
    };

    function appendItemCallback(carousel, start, last, data)
    {
    console.log("appendItemCallback: " +
    carousel + ", " + start + ", " + last + ", " + data);
    var i = start;
    $("/items/item", data).each(function() {
    // loop through all the items returned
    console.log(i + ": " + $(this).text());
    var item = carousel.add(i, getItemHTML(this));
    // ..and add them to the carousel
    i++;
    });
    // Trigger loaded
    carousel.loaded();
    };

    function getItemHTML(data)
    {
    var alias = $('alias', data).text();
    var ptr = $('ptr', data).text();
    var title = $('title', data).text();

    var url_image = "http://rama.libraries.claremont.edu/cgi-bin/thumbnail.exe?CISOROOT=" + alias +
    "&CISOPTR=" + ptr;
    var url_item = "http://rama.libraries.claremont.edu/u?" + alias + "," + ptr;

    return '<div>' +
    '<a href="' + url_item + '" title="' + title + '">' +
    '<img src="' + url_image + '" alt="' + title + '" /></a></div>';
    };

    Even with that code it was making an ajax call ever click because available was always set to false.


    available: function(first, last) {
    if (last == undefined)
    last = first;

    if (priv.size >= last) //jk: changed from priv.end
    return true;

    priv.end = last;

    return false;
    },

    When I changed the available function to look at priv.size instead of priv.end it worked.
    I don’t understand what priv.end is suppsed to do, or why it is only
    changed in the available function.

    thank you.

  2. Jan said on Tuesday, January 2, 2007 at 14:05h

    No, thats not a bug. jCarousel just requests the items needed for the next scroll. If you add more items than requested you need to implement your own routines for checking if a new ajax request is required. available is true when the range is requested before and not when the items exist actually.

Leave a Reply

Do not post support requests for jCarousel here. If you need help for a problem:
  1. Create a page where i can see your carousel in action
  2. Post it to the jQuery Mailinglist (Add the word "jCarousel" to the subject, so i can filter out mails regarding jCarousel).


Stoppt die Vorratsdatenspeicherung! Jetzt klicken & handeln!Willst du auch bei der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien: