我正在尝试重新调整或破坏并重新涂抹jcarousellite插件,但我没有成功,这是因为我创建了一个网站,每个页面都是“ li”,当通过菜单导航时,那个“页面” ...

我已经尝试将其用于调整大小,并重新涂抹Jcarousellite,但它没有起作用:

$('#mega').jCarouselLite = null;

这是我正在使用的代码,但是如果我不断重新涂抹jcarousellite,旋转木马会发疯!

$(document).ready(function(){
    w = $(window).width();
    h = $(window).height();
    $('#mega li').css('width',w);
    $('#mega li').css('height',h);
    $('#mega').jCarouselLite({
        circular:false,
        vertical:true,
        speed:1000,
        visible:1,
        btnGo:["#home", "#comofunciona", "#porquemegafome", "#contato"]
    });
});
$(window).resize(function() {
    w = $(window).width();
    h = $(window).height();
    $('#mega li').css('width',w);
    $('#mega li').css('height',h);
    $('#mega').jCarouselLite({
        circular:false,
        vertical:true,
        speed:1000,
        visible:1,
        btnGo:["#home", "#comofunciona", "#porquemegafome", "#contato"]
    });
});

解决方案:

“ Idrumgood”,我只是尝试使用“ LI”来做到这一点,但是搜索有关停用插件的更多信息,我发现我也必须删除点击,因此,这是我必须应用的代码:

$(window).resize(function() {
    $('#mega').jCarouselLite = null;
    $('#home, #comofunciona, #porquemegafome, #contato').unbind('click'); //buttons I defined on btnGo option
    runCarousel(); //again
    aClick(); // function where I get the li index and save into a hidden input, on resize it keeps li position! :)
});
有帮助吗?

解决方案

当创建旋转木马时,Jcarousellite(几乎所有旋转木载插件)会注入一些额外的标记。通常是设置为宽度的包含元素 elementsWidth * numberOfElements 溢出隐藏。还创建了其中的第二个包含元素,这就是实际移动的原因。然后将您的元素漂浮,并更改二级包含元件的左边缘以产生滚动效果。

这是,如果您想更改它,则需要更改包含Divs的宽度和/或在窗口大小尺寸时滚动的元素的宽度。

尝试更改窗口大小上的这些元素的尺寸,而不是重新定位旋转木马,看看会发生什么(没有您的标记,这是关于我可以提供的最佳建议)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top