Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin'
Browse files Browse the repository at this point in the history
  • Loading branch information
desandro committed Dec 19, 2021
2 parents 5e71086 + 75fe5d7 commit 12ca19d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions js/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ proto.create = function() {
this.element.setAttribute( 'aria-hidden', 'true' );
this.x = 0;
this.shift = 0;
this.element.style[ this.parent.originSide ] = 0;
};

proto.destroy = function() {
Expand All @@ -49,6 +50,7 @@ proto.destroy = function() {
this.element.style.position = '';
var side = this.parent.originSide;
this.element.style[ side ] = '';
this.element.style.transform = '';
this.element.removeAttribute('aria-hidden');
};

Expand All @@ -71,8 +73,14 @@ proto.updateTarget = proto.setDefaultTarget = function() {

proto.renderPosition = function( x ) {
// render position of cell with in slider
var side = this.parent.originSide;
this.element.style[ side ] = this.parent.getPositionValue( x );
var sideOffset = this.parent.originSide === 'left' ? 1 : -1;

var adjustedX = this.parent.options.percentPosition ?
x * sideOffset * ( this.parent.size.innerWidth / this.size.width ) :
x * sideOffset;

this.element.style.transform = 'translateX(' +
this.parent.getPositionValue( adjustedX ) + ')';
};

proto.select = function() {
Expand Down

0 comments on commit 12ca19d

Please sign in to comment.