gpt4 book ai didi

Jquery 轮播和 JQuery UI slider

转载 作者:行者123 更新时间:2023-12-01 03:54:11 26 4
gpt4 key购买 nike

是否可以将 JQuery UI slider 与 JQuery Carousel 插件一起使用?

http://jqueryui.com/demos/slider/

http://sorgalla.com/projects/jcarousel/

我猜这将与 Slider 插件的 change 事件的回调有关,但我不知道如何将其绑定(bind)。

现阶段我的jquery是:

$(document).ready(function() {
jQuery('#tiles').jcarousel({
//auto: 2,
wrap: 'last'
});

$( "#slider" ).slider({
change: function(event, ui) {
// callback when the slide event fires.
}
});


});

这可能吗?我宁愿自己弄清楚,但不知道从哪里开始。

我曾短暂地寻找过一个具有类似轮播功能的 slider ,但我惨遭失败。

谢谢~

编辑更新的代码:

jQuery(document).ready(function() {

jQuery("#tiles").jcarousel({
//auto: 2,
scroll: 1,
buttonNextHTML: null,
buttonPrevHTML: null
});

$( "#slider" ).slider({
min: 0,
max:4,
change: function(event, ui) {
alert(ui.value);
jQuery('#tiles').scroll(jQuery.jcarousel.intval(ui.value));
}
});

});

大概我需要提前知道有多少个项目,才能设置 slider 最小/最大?

再次感谢

最佳答案

阅读此页面的源代码 - http://sorgalla.com/projects/jcarousel/examples/static_controls.html

在 slider 中您可以使用:

$( "#slider" ).slider({
change: function(event, ui) {
carousel.scroll(jQuery.jcarousel.intval(ui.value));
}
});

更新:

function mycarousel_initCallback(carousel) {
$( ".slider" ).bind( "slidechange", function(event, ui) {
carousel.scroll(ui.value);
});
};

jQuery(document).ready(function() {
jQuery("#mycarousel").jcarousel({
scroll: 1,
initCallback: mycarousel_initCallback,
buttonNextHTML: null,
buttonPrevHTML: null
});

$('.slider1').slider({
value: 1,
min:1,
max:6,
});

});

关于Jquery 轮播和 JQuery UI slider ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4616003/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com