Skip to content

Commit

Permalink
adding center slide functionality and updating readme (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhayward authored and flaviocopes committed Apr 19, 2017
1 parent b0ec647 commit 2006945
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -79,6 +79,7 @@ type_text_brightness: 0
item: 1
slideMove: 1
slideMargin: 0
centerSlide: 'false'
loop: 'false'
mode: 'fade'
controls: 'true'
Expand Down Expand Up @@ -146,6 +147,7 @@ Here is a breakdown of lightSlider's options you can use in this plugin:
| item | The number of slides to show at a time |
| slideMove | This option sets the number of slides moved at a time. The default setting is `1`. |
| slideMargin | This option sets the spacing between each slide. |
| centerSlide | This option centers the active slide within the slider, rather than positioning it on the left side of the slider. |
| mode | Sets the transition mode. Your options are `slide` and `fade`. |
| cssEasing | Type of easing to be used for css animations. defaults to `ease` |
| easing | Type of easing to be used for jquery animations. defaults to `linear` |
Expand Down
7 changes: 7 additions & 0 deletions js/lightslider.js
Expand Up @@ -8,6 +8,7 @@
autoWidth: false,
slideMove: 1,
slideMargin: 10,
centerSlide: false,
addClass: '',
mode: 'slide',
useCSS: true,
Expand Down Expand Up @@ -610,6 +611,12 @@
_sV += (parseInt($children.eq(i).width()) + settings.slideMargin);
}
}
if (settings.centerSlide) {
var extraWidth = elSize - $children.eq(scene).width();
if (extraWidth > 1) {
_sV -= Math.round(extraWidth / 2);
}
}
return _sV;
},
slideThumb: function () {
Expand Down

0 comments on commit 2006945

Please sign in to comment.