带有jcarousel的多行 [英] Multiple rows with jcarousel

查看:113
本文介绍了带有jcarousel的多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jcarousel来构建一个包含多行的容器,我尝试过一些东西,但没有运气。任何人都可以就如何创建它提出任何建议吗?

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?

推荐答案

我们不得不做出类似的修改。我们通过扩展默认选项,包括行值和每个项目的宽度(我们称之为模块)然后将宽度除以行数来实现。

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.

代码添加到jCarousel函数...

Code added to jCarousel function...

添加到默认选项:

moduleWidth: null,
rows:null,

然后在创建jCarousel时设置:

Then set when creating jCarousel:

$('.columns2.rows2 .mycarousel').jcarousel( {
        scroll: 1,
        moduleWidth: 290,
        rows:2,
        itemLoadCallback: tonyTest,
        animation: 'slow'
    });

查找并编辑以下行:

$.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 );

希望这会有所帮助,

Tony Dillon

Tony Dillon

这篇关于带有jcarousel的多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆