[jQuery] Re: Flexible jCarousel
Klaus Hartl wrote: Jan Sorgalla schrieb: ok, i see now. One of the main differences between the old and the new version of jCarousel is, that you no longer have to pass itemsVisible as option. The number of visible items are calculated on the fly depending on the sizes of the clip and the items. I've done that mainly to allow items of different sizes and a flexible carousel width. But i never thought about your special case ;) In the new new version, you can do it with the callback functions (i've adjusted the example posted before) but its also a little bit hackish. So, in short, i don't have a built-in solution right now but i keep that in mind... Jan Thank you Jan! Excellent plugin by the way, soon to be seen on plazes :-) -- Klaus Thanks :) If your using the new version, just let me know if you find bugs or have suggestions. I'm always open for improvements... Jan
[jQuery] Re: Flexible jCarousel
Hi Klaus, Hi jQuerians! I was wondering if there is a mod for jCarousel out there, that allows it to be flexible? I need the width of the list and its items to be flexible (depending on the browser width). I tried only a bit yet and tinkered with the windows resize event, to adjust the width of .jcarousel-clip and the list elements, that works fine, but the scroll amount needs to be adjusted as well and I think changing that is not as easy... Has somebody done that? If not, I'd like to request that feature, respectively I will have to do that mod anyway... :-) i disappeard from the list for a while because i had to sort some things out. But i worked on a complete new version of jCarousel which does exactly what you want. Its still in a alpha state but i've setup an example page: http://sorgalla.com/projects/jcarousel-preview/examples/static.html There are a lot of api and configuration changes so just ask if something isn't clear. Jan
[jQuery] Re: Flexible jCarousel
Jan Sorgalla schrieb: Hi Klaus, Hi jQuerians! I was wondering if there is a mod for jCarousel out there, that allows it to be flexible? I need the width of the list and its items to be flexible (depending on the browser width). I tried only a bit yet and tinkered with the windows resize event, to adjust the width of .jcarousel-clip and the list elements, that works fine, but the scroll amount needs to be adjusted as well and I think changing that is not as easy... Has somebody done that? If not, I'd like to request that feature, respectively I will have to do that mod anyway... :-) i disappeard from the list for a while because i had to sort some things out. But i worked on a complete new version of jCarousel which does exactly what you want. Its still in a alpha state but i've setup an example page: http://sorgalla.com/projects/jcarousel-preview/examples/static.html There are a lot of api and configuration changes so just ask if something isn't clear. Jan Hi Jan, thanks for the fast answer! Unfortunately the example is not what I need, I was unclear apparently. What I need is to have a flexible carousel with a constant amount of items to be shown, for example 3. So if the window gets bigger, the list items as well as the clipped element will get bigger (as if they had a width given in %), and the amount of px to scroll left/right has to as well then. -- Klaus
[jQuery] Re: Flexible jCarousel
Klaus Hartl schrieb: Here's what I did - it's a hack and you could do better but it works for now and you get the picture: I added a flexibleWidth option and than added the following lines to the init method: // Mod - allow flexible width if (priv.o.flexibleWidth) jQuery(window).bind('resize', function() { var jCarouselClip = jQuery(.jcarousel-clip, priv.scope); var jCarouselClipAvailWidth = parseInt(jCarouselClip[0].parentNode.offsetWidth - 2 * 40); jCarouselClip.css({ width: jCarouselClipAvailWidth }); jCarouselClip.find('li').css({ width: Math.ceil(jCarouselClipAvailWidth / priv.o.itemVisible) }); priv.dimension = i.offsetWidth + priv.margin(i, marginLeft) + priv.margin(i, marginRight); priv.resize(); priv.animate(); // readjust left positioning }); Would be cool if you could add that in a more proper way if you like that :-) Scratch that 2 * 40, that is special to my project, just needed to get that in as fast as possible...: var jCarouselClipAvailWidth = jCarouselClip[0].parentNode.offsetWidth; -- Klaus