ryrych / rcarousel

yet another jQuery UI carousel
http://ryrych.github.com/rcarousel/
171 stars 48 forks source link

Bug when one element for getTotalPages ?? #47

Open ghost opened 12 years ago

ghost commented 12 years ago

Hi all,

When i have one element, getTotalPages return me 2.

I put a condition in the code and it works for me (visibility:1, step:1).

The condition in _paginate(), to put at line 336, after _complement condition :

if ( (_end - _start) != 0 ){
    // first add old elemets; for 3rd page it adds [FGHI…]
    // remember the page we add to (_index)
    _oldFirstEl = _start - ( _visible - (_end - _start) );
    _oldLastEl = _oldFirstEl + ( _visible - (_end - _start) );
    _index = _append( _oldFirstEl, _oldLastEl );

    // then add new elements; for 3th page it is J element:
    // [fghiJ]
    _append( _start, _end, _index );
}

I don't know if it works for all cases. I can't test :s