Created
August 29, 2016 11:22
-
-
Save probil/e42bdd9a01d8788e935077fa5bbf61b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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