Skip to content

Commit

Permalink
fix margin for infinite vertical
Browse files Browse the repository at this point in the history
  • Loading branch information
Visual Idiot committed Nov 21, 2015
1 parent 428fcb3 commit 094dc42
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/js/unslider-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions src/js/unslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,6 @@
)
);
});

// So then we need to hide the first slide
self.$container.css({marginLeft: '-100%'});
};

// Remove any trace of arrows
Expand Down Expand Up @@ -463,6 +460,11 @@
prop = 'right';
}

if(self.options.infinite) {
// So then we need to hide the first slide
self.$container.css('margin-' + prop, '-100%');
}

return self.slide(prop, to);
};

Expand All @@ -471,6 +473,14 @@
// can just call as is
self.animateVertical = function(to) {
self.options.animateHeight = true;

// Normal infinite CSS fix doesn't work for
// vertical animation so we need to manually set it
// with pixels. Ah well.
if(self.options.infinite) {
self.$container.css('margin-top', -self.$slides.outerHeight());
}

return self.slide('top', to);
}

Expand Down

0 comments on commit 094dc42

Please sign in to comment.