开发者

how would i upgrade this code to work with jquery 1.6.2

开发者 https://www.devze.com 2023-03-21 09:30 出处:网络
how would i upgrade this code to work with jquery 1.6.2 as it only seems to work if i useVersion 1.2.6.

how would i upgrade this code to work with jquery 1.6.2 as it only seems to work if i use Version 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>

link to my开发者_开发问答 issue: http://www.floodgateone.com/catering/index1.html

thanks for any help


If you're upgrading jQuery, then also upgrade to the latest jQuery UI where slider setup is much easier:

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

EDIT:

Working example, using latest jQuery and jQuery UI: Fiddle

Full-screen link: here

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号