Skip to content

Commit 83f11f3

Browse files
committed
Fixing cellSpacing width offset
1 parent 1eb582c commit 83f11f3

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "nuka-carousel",
33
"main": "index.js",
4-
"version": "0.0.6",
4+
"version": "0.0.7",
55
"homepage": "https://github.com/kenwheeler/nuka-carousel",
66
"authors": [
77
"Ken Wheeler <ken_wheeler@me.com>"

lib/carousel.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,17 @@ var Carousel = _React2['default'].createClass({
393393
var self = this,
394394
slideWidth,
395395
frame;
396+
396397
frame = _React2['default'].findDOMNode(this.refs.frame);
398+
397399
if (typeof this.props.slideWidth !== 'number') {
398400
slideWidth = parseInt(this.props.slideWidth);
399401
} else {
400402
slideWidth = frame.offsetWidth / this.props.slidesToShow * this.props.slideWidth;
401403
}
404+
405+
slideWidth -= this.props.cellSpacing * ((100 - 100 / this.props.slidesToShow) / 100);
406+
402407
this.setState({
403408
frameWidth: frame.offsetWidth,
404409
slideCount: this.props.children.length,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nuka-carousel",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"description": "Pure React Carousel",
55
"main": "index.js",
66
"dependencies": {

src/carousel.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,17 @@ const Carousel = React.createClass({
376376

377377
setDimensions() {
378378
var self = this, slideWidth, frame;
379+
379380
frame = React.findDOMNode(this.refs.frame);
381+
380382
if (typeof this.props.slideWidth !== 'number') {
381383
slideWidth = parseInt(this.props.slideWidth);
382384
} else {
383385
slideWidth = (frame.offsetWidth / this.props.slidesToShow) * this.props.slideWidth;
384386
}
387+
388+
slideWidth -= this.props.cellSpacing * ((100 - (100 / this.props.slidesToShow)) / 100);
389+
385390
this.setState({
386391
frameWidth: frame.offsetWidth,
387392
slideCount: this.props.children.length,

0 commit comments

Comments
 (0)