예를 들어, jCarousel은 플러그인의 범위를 넘어서고 있기 때문에 jCarousel 자체를 업데이트하지 않습니다. 문서에서, 당신이 언급 한 remove() 메소드가 작동하는 것처럼 보입니다. 그러나 jCarousel 객체를 실제로 "올바른 작업을 수행하고"버튼, 스크롤 등을 업데이트 할 수있는 방법이 없었습니다.
jCarousel 클래스에 추가 메서드를 작성했습니다. 정확히 그. Carousel에서 첫 번째 항목을 제거하고 다음/이전 버튼이 활성화/비활성화되도록 모든 것을 다시 작성하려면 removeAndAnimate (1)를 호출하면됩니다.
또한 주목할 가치가있는 remove() 함수 jCarousel은 현재 표시되고있는 항목을 제거하지 못하도록합니다 (사용자가 클릭 한 다음 회전식 키로 이미지를 제거 할 수 있도록 허용). 예를 들어,).
removeAndAnimate (I)의 구현 :
removeAndAnimate: function(i) {
var e = this.get(i);
var d = this.dimension(e);
if (i < this.first) this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + d + 'px');
e.remove();
this.options.size--;
var di = this.options.visible != null ? Math.ceil(this.clipping()/this.options.visible) : null;
var li = this.list.children('li');
var self = this;
if (li.size() > 0) {
var wh = 0, i = this.options.offset;
li.each(function() {
self.format(this, i++);
wh += self.dimension(this, di);
});
this.list.css(this.wh, wh + 'px');
}
this.scroll(0,true);
this.buttons();
}
내가 직접 제거() 구현 한 후이를 배치하는 것이 좋습니다. jQuery를 사용하여 jCarousel 인스턴스 자체에 액세스하려면 콜백 함수 외부에서 다음을 수행하십시오.
var carousel = $("#mycarousel").data("jcarousel");
carousel.removeAndAnimate(1);
그래야합니다!
알아두면 좋을 것 같습니다. 나는 결국 다른 플러그인을 선택했습니다. –