Multiple rows with jcarousel

后端 未结 6 1664
别跟我提以往
别跟我提以往 2020-12-03 12:50

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?

6条回答
  •  情书的邮戳
    2020-12-03 13:21

    If you need a quick solution for a fixed or one-off requirement that definitely doesn't involve changing core library code which may be updated from time to time, the following may suit. To turn the following six items into two rows on the carousel:

    contents
    contents
    contents
    contents
    contents
    contents

    you can use a little JS to wrap the divs into LI groups of two then initialise the carousel. your scenario may allow you to do the grouping on the server isn't always possible. obviously you can extend this to however many rows you need.

    var $pArr = $('div.item');
    var pArrLen = $pArr.length;
    for (var i = 0;i < pArrLen;i+=2){
          $pArr.filter(':eq('+i+'),:eq('+(i+1)+')').wrapAll('
  • '); };
提交回复
热议问题