Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_setTransform (offset) {
const me = this
offset = offset || 0
arrayFrom(me.$items).forEach(function ($item, key) {
let transformCallback = function () {
let distance = me._offset[key] + offset
let transform = `translate(${distance}px, 0)`
if (me._options.direction === 'vertical') {
transform = `translate(0, ${distance}px)`
}
$item.style.webkitTransform = transform
$item.style.transform = transform
}
// opacity 要先改变
me._options.useFade && ($item.style.opacity = 0);
if ((me._options.useFade && key == me._current) || !me._options.useFade) {
_setOffset () {
let me = this
let index = me._position.indexOf(me._current)
me._offset = []
arrayFrom(me.$items).forEach(function ($item, key) {
me._offset.push((key - index) * me._distance)
})
}
_setTransition (duration) {
let me = this;
duration = duration || (this._options.duration || 'none')
let transition = duration === 'none' ? 'none' : (this._options.useFade ? 'opacity ' : 'transform ') + duration + 'ms'
arrayFrom(this.$items).forEach(function ($item, key) {
$item.style.webkitTransition = transition
$item.style.transition = transition
})
}
_itemDestoy () {
this.$items.length && arrayFrom(this.$items).forEach(item => {
item.removeEventListener('webkitTransitionEnd', this.transitionEndHandler, false)
})
}