Removing an item from jCarousel plug-in

前端 未结 5 978
臣服心动
臣服心动 2020-12-17 06:27

I have a question regarding the jCarousel plug-in (from sorgalla). How do I remove items from it the right way?

You can see how far I\'ve gone here. Try deleting a

5条回答
  •  甜味超标
    2020-12-17 06:44

    I found where the problem with white boxes comes from. JCarousel method format() doesn't replace class names, but just add new one. I've rewrote this function and it works well for me:

    format: function(e, i) {
            // remove all class names matches 'jcarousel-item' at the start
            $(e)[0].className = $(e)[0].className.replace(/\bjcarousel\-item.\d-*?\b/g, '');
            // add new class names  
            var $e = $(e).addClass('jcarousel-item').addClass('jcarousel-item-' + i).css({
                'float': 'left',
                'list-style': 'none'
            });
            $e.attr('jcarouselindex', i);
            return $e;
    }
    

提交回复
热议问题