简体   繁体   中英

jcarousel images disappear after scroll event

I have an autocomplete text input that triggers a slider using jcarousel to scroll to the image of the selected person. The problem is, if you search once, it works, but searching again makes all the images disappear.

Here is the code that controls the input:

jQuery('#team_select2').change(function() {

    var idx = $('#team_select2').val();

    if(idx == '')
    {
        carousel.scroll(1);
        $('.details').hide();
        return false;
    }

    carousel.scroll(idx);
    $('.details').hide();
    $('#'+idx+'_details').show();
});

You can see it breaking in action if you go to http://welchhornsby.com/new-team-page/ and try searching for two of the people in the list.

Anyone have any idea why it would be breaking like that?

Found the answer right after posting this. Just changed the 4th to last row from carousel.scroll(idx); to carousel.scroll(idx*1);

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