Permalink
Browse files

fixed prob with circular & decrementing < 0

  • Loading branch information...
1 parent a82e40f commit b95b7148240927ccdac582dd1092eda735fa75ef @kswedberg committed Apr 23, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 jcarousellite.js
View
@@ -117,7 +117,8 @@ $.fn.jCarouselLite = function(options) {
if ( o[btn] ) {
o['$' + btn] = $.isFunction( o[btn] ) ? o[btn].call( div[0] ) : $( o[btn] );
- o['$' + btn].bind('click.jc', function() {
+ o['$' + btn].bind('click.jc', function(event) {
+ event.preventDefault();
var step = index === 0 ? curr - o.scroll : curr + o.scroll;
if (o.directional) {
// set direction of subsequent scrolls to:
@@ -142,7 +143,8 @@ $.fn.jCarouselLite = function(options) {
if (o.btnGo) {
$.each(o.btnGo, function(i, val) {
- $(val).bind('click.jc', function() {
+ $(val).bind('click.jc', function(event) {
+ event.preventDefault();
return go(o.circular ? visibleNum + i : i);
});
});
@@ -188,6 +190,10 @@ $.fn.jCarouselLite = function(options) {
curr = curr % tl;
to = to % tl;
ul.css(animCss, -curr * liSize);
+ } else if ( to < curr && to < 0) {
+ curr += tl;
+ to += tl;
+ ul.css(animCss, -curr * liSize);
}
curr = to + (to % 1);

0 comments on commit b95b714

Please sign in to comment.