JCarousel通告“不停" [英] JCarousel circular "no stop"
问题描述
是否可以将JCarousel配置为循环不停"?我希望将转盘配置为连续不断的圆周运动.不放慢脚步.
It is possible to configure JCarousel for a circular "no stop" ? I wish configure my carousel for a continuous constant circular moving. without slowing down.
谢谢
推荐答案
要使其不断旋转,您应该能够设置auto:.1和animation:5000(或您想要的任何速度.下面是一个示例)我花了很长时间才能正确进行操作.它是通过jQuery AJAX获取数据.
To get it to constantly rotate you should be able to set auto:.1 and animation:5000 (or whatever speed you want. Below is an example that took me a long time to get going correctly. It is getting data through jQuery AJAX.
var lis; //Global variable holding the data.
var myCarousel01; //Global variable holding the carousel.
$(document).ready(function () {
updateData();
$("#tableapp").ajaxStop(function () {
InitiateCarousels();
}
rebindCarousels();
});
});
function updateData() {
$.get('AjaxPages/ApplicationMonitor.aspx', function (data) {
lis = $(data).find("li");
});
}
function InitiateCarousels() {
jQuery('#mycarousel1').jcarousel({
wrap: 'circular',
auto:.1, //Amount of time you want slide to stop in seconds
animation:5000, //Desired speed in milliseconds
easing:"linear", //Prevents the slides from "slowing down"
initCallback: myCarousel01_initCallback,
itemFirstInCallback: myCarousel01_itemFirstInCallback
});
});
function myCarousel01_initCallback(carousel, state) {
if (state == "init") {
myCarousel01 = carousel; //Bind carousel to global variable so you can retrieve it later.
}
}
function rebindCarousels() { //This function gets called after data is binded to the lis variable. See: "ajaxStop" function above.
//Rebind Carousel01
myCarousel01.list.empty();
$.each(lis, function (i, l) {
myCarousel01.add(i + 1, l);
});
myCarousel01.size(lis.length);
}
希望这对某人有帮助.花了一些时间才能完成此工作,我在这里进行了粗略的复制/粘贴,因此可能需要进行一些调整.如果有帮助,请标记为已回答.
Hope this helps someone. It took a while to get this working and I did a rough copy/paste here so it may take a little tweaking. If this helps, please mark it as answered.
这篇关于JCarousel通告“不停"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!