Skip to content

Instantly share code, notes, and snippets.

@probil
Created August 29, 2016 11:22
Show Gist options
  • Save probil/e42bdd9a01d8788e935077fa5bbf61b5 to your computer and use it in GitHub Desktop.
Save probil/e42bdd9a01d8788e935077fa5bbf61b5 to your computer and use it in GitHub Desktop.
"use strict";
const LEFT = 'left';
const RIGHT = 'right';
/**
* Calculates sign based on direction
* @param {string} direction
* @returns {Number}
*/
const getSign = (direction) => (direction === LEFT) ? -1 : 1;
/**
* Moves slider using css transform
* @param {string} direction
*/
const moveSlider = (direction = LEFT) => {
$sliderOuter.css({
transform: `translate3d(${getSign(direction)*data.settings.sliderPos}'px, 0, 0)`
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment