I'm trying to use jcarousel to build a container with multiple rows, I've tried a few things but have had no luck. Can anyone make any suggestions on how to create it?
What is the code you have tried? I'm thinking it will require an extension or modification to jCarousel.
Hi,
We have had to make a similar modifiaction. We do this by extending the default options, to include a rows value, and the width of each item (we call them modules) then divide the width by the number of rows.
Code added to jCarousel function...
Add to default options:
moduleWidth: null, rows:null,
Then set when creating jCarousel:
$('.columns2.rows2 .mycarousel').jcarousel( { scroll: 1, moduleWidth: 290, rows:2, itemLoadCallback: tonyTest, animation: 'slow' });
The find and edit the lines in: $.jcarousel = function(e, o) {
if (li.size() > 0) { ... moduleCount = li.size(); wh = this.options.moduleWidth * Math.ceil( moduleCount / this.options.rows ); wh = wh + this.options.moduleWidth;
this.list.css(this.wh, wh + 'px');
// Only set if not explicitly passed as option if (!o || o.size === undefined) this.options.size = Math.ceil( li.size() / this.options.rows );
Hope this helps,
Tony Dillon
Hi Sike
I'm having trouble with getting the 2 rows to work. Could you please post the HTML you used?
I did the changes to the jquery file but nothing changed.
I even deleted:
if (li.size() > 0) {
var wh = 0, i = this.options.offset;
li.each(function() {
self.format(this, i++);
wh += self.dimension(this, di);
});
moduleCount = li
.size();
wh = this.options.moduleWidth * Math.ceil( moduleCount / this.options.rows );
wh = wh + this.options.moduleWidth;
this.list.css(this.wh, wh + 'px');
// Only set if not explicitly passed as option
if (!o || o.size === undefined)
this.options.size = Math.ceil( li.size() / this.options.rows );
}
Even with this deleted it did not change the jcarousel..
I found this post on Google Groups that has a working version for multiple rows. I have used this and it works great. http://groups.google.com/group/jquery-en/browse_thread/thread/2c7c4a86d19cadf9