2010-05-14 5 views
1
var carousel = jQuery('#mycarousel').data('jcarousel');  
var index = carousel.size() + 1; 
carousel.size(index); 
var html = '<li> some html </li>'; 
carousel.add(index, html); 
carousel.scroll(index, 1); 

마지막 스크롤 메서드가 실행되지만 항상 그런 것은 아닙니다. 이것은 JCarousel의 버그입니까? 부울이다JCarousel 스크롤 방법이 항상 실행되는 것은 아닙니다.

/** 
* Scrolls the carousel to a certain position. 
* 
* @method scroll 
* @return undefined 
* @param i {Number} The index of the element to scoll to. 
* @param a {Boolean} Flag indicating whether to perform animation. 
*/ 
scroll: function(i, a) { 
    if (this.locked || this.animating) 
     return; 
    this.animate(this.pos(i), a); 
} 

답변

1

@param a {Boolean} Flag indicating whether to perform animation.

파라미터 2 :

다음은 JCarousel의 스크롤에있어서의 코드이다.

carousel.scroll(index, 1);

그래서 어쩌면이 더 잘 작동 것 :

carousel.scroll(index, true);

1

var position = 11; // assuming that every page contains 10 elements. 
// now this will move your scroll to a desired position (first element to show) 
jQuery('#myCarousel').jcarousel('scroll',position); 
같은 것을 시도하십시오 당신은 정수를 지정한

희망이 도움이됩니다.

관련 문제