简体   繁体   中英

jquery code working with version 1.7.1 but not with latest version

i'm using a jquery code on my website to control a slideshow. i've collected some codes supposed to work with jquery version 1.7.1. it works perfectly, but when using jquery latest version my code doesn't work. is there a lot of difference between those 2 versions ? is there a way of fixing it because I would like to use jquery latest version.

here is my js code :

function slideshow(){

var $descriptions = $('#carousel-descriptions').children('li'),
    $controls = $('#carousel-controls').find('span'),
    $carousel = $('#carousel')
        .roundabout({childSelector:"li", minOpacity:0, maxOpacity:1, minScale: 1, btnNext: ".next", btnPrev:".prev",})
        .on('focus', 'li', function() {
            var slideNum = $carousel.roundabout("getChildInFocus");

            $descriptions.add($controls).removeClass('current');
            $($descriptions.get(slideNum)).addClass('current');
            $($controls.get(slideNum)).addClass('current');
        });

$controls.on('click dblclick', function() {
    var slideNum = -1,
        i = 0, len = $controls.length;

    for (; i<len; i++) {
        if (this === $controls.get(i)) {
            slideNum = i;
            break;
        }
    }

    if (slideNum >= 0) {
        $controls.removeClass('current');
        $(this).addClass('current');
        $carousel.roundabout('animateToChild', slideNum);
    }
});

}

I can also do a jsfiddle if needed, but maybe someone can see conflicts with new jquery version in my code ?

thanks a lot for your help,

加载jQuery后,使用: http : //code.jquery.com/jquery-migrate-1.2.1.js ,这应该会有所帮助

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM