gpt4 book ai didi

javascript - 我如何升级此代码以使用 jquery 1.6.2

转载 作者:行者123 更新时间:2023-11-28 21:19:34 26 4
gpt4 key购买 nike

我如何升级此代码以使用 jquery 1.6.2,因为它似乎只有在我使用版本 1.2.6 时才有效。

<script type="text/javascript" charset="utf-8">
window.onload = function () {
var container = $('div.sliderGallery');
var ul = $('ul', container);

var itemsWidth = ul.innerWidth() - container.outerWidth();

$('.slider', container).slider({
min: 0,
max: itemsWidth,
handle: '.handle',
stop: function (event, ui) {
console.log(ui.value);
ul.animate({
'left': ui.value * -1
}, 500);
},
slide: function (event, ui) {
ul.css('left', ui.value * -1);
console.log(ui.value);
}
});
};
</script>

链接到我的问题:http://www.floodgateone.com/catering/index1.html

感谢您的帮助

最佳答案

如果您要升级 jQuery,则还要升级到最新的 jQuery UI其中 slider 设置更容易:

$(".slider").slider();

编辑:

工作示例,使用最新的 jQuery 和 jQuery UI:Fiddle

全屏链接:here

关于javascript - 我如何升级此代码以使用 jquery 1.6.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6740487/

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