I raised the question and found the answer too. All you have to do is resize
the div with class jcarousel-clip.
Only problem that might arise is that the new clip div displays a non
integer number of items (say 6 and a half or another) and this might not be
what you're looking for. I suggest performing some operation to make this
number an integer this way:

$(window).resize(function(){

var itemsShown = parseInt($("#myContainerDiv").css("width")) -
parseInt($("#myContainerDiv").css("width")) %
parseInt($("#myListimg").css("width"))+"px";

$("#myContainerDiv div.jcarousel-clip").css("width", itemsShown);

});

This way first I calculate the number of items that can be shown with the
new size of the container making it into an integer. Note that
div#myContainerDiv here is the div that I created to contain the list and
ul#myList is the list of Images that I created wich previously receives a
$("#myList").jcarousel(...) treatment, while div.jcarousel-clip is a div
generated by the jCarousel plugin automatically.

On 1/10/07, Dave Methvin <[EMAIL PROTECTED]> wrote:

>  I'm using jCarousel for a menu and I need it to be very elastic,
> meaning it has to change size when you resize the window. I was
> wondering if there is a way to change the number of images
> shown after you have already initialized it. BTW jCarousel is a
> great plug in. I recommend it to everyone.

I haven't looked a jCarousel, but normally if a plugin wants to be able to
do something like that it has to handle a resize event so that it can
recalculate and reposition everything. If jCarousel doesn't do that, but
initializes pretty quickly, you could remove and recreate it in your own
window.resize handler.


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to