Javascript 在运行时重新初始化jCarouselLite
谁能告诉我如何在运行时重新初始化jCarouselLite插件。我有5个滑块在一个页面,我想执行滑块之间的切换。所有代码都完成了。我想要的是在当前滑块的运行时重新初始化“jCarouselLite”插件。我的代码如下:Javascript 在运行时重新初始化jCarouselLite,javascript,jquery,Javascript,Jquery,谁能告诉我如何在运行时重新初始化jCarouselLite插件。我有5个滑块在一个页面,我想执行滑块之间的切换。所有代码都完成了。我想要的是在当前滑块的运行时重新初始化“jCarouselLite”插件。我的代码如下: if(isNext){ /* Removing Slider */ $(current_selector).jCarouselLite = null; $(".btn_prev"+current).unbind('click'); $(".b
if(isNext){
/* Removing Slider */
$(current_selector).jCarouselLite = null;
$(".btn_prev"+current).unbind('click');
$(".btn_next"+current).unbind('click');
/* Re-initializing Slider */
$(current_selector).jCarouselLite({
btnPrev: ".btn_prev"+current,
btnNext: ".btn_next"+current,
circular: false,
visible: 1,
});
}else{ alert("in prev");}
任何帮助都将不胜感激。谢谢。这帮我做到了:
var theModelCarousel = null;
$(current_selector).jCarouselLite({
......
initCallback: modelCarousel_initCallback
});
//and the function
function modelCarousel_initCallback(carousel) {
theModelCarousel = carousel;
// Callback functuions if needed
};
function clearModelCarousel() {
theModelCarousel.reset();
theModelCarousel.add(0,someImageURL1);
theModelCarousel.add(1,someImageURL2);
theModelCarousel.size(2);
}
var theModelCarousel=null;
$(当前选择器).jCarouselLite({
......
initCallback:modelCarousel_initCallback
});
//以及功能
函数模型carousel_initCallback(carousel){
模型转盘=转盘;
//回调函数(如果需要)
};
函数clearModelCarousel(){
重置()模型;
添加(0,someImageURL1);
添加(1,someImageURL2);
模型尺寸(2);
}
感谢您的回复,但我认为您的解决方案适用于jcarousel,我正在使用jCarouselLite。jCarouselLite中未定义重置、添加和大小方法。请看看你能不能想出一些关于jCarouselLite的建议。这里是jCarouselLite的链接。谢谢。为什么这么多人把jcarousel和jcarousellite搞混了?这显然不适用于jcarousellite。