diff --git a/src/swipe/index.js b/src/swipe/index.js index 9f7ce03..768201b 100644 --- a/src/swipe/index.js +++ b/src/swipe/index.js @@ -55,7 +55,7 @@ class Swipe extends Component { }, arrow: { type: String, - default: 'hover' // hover or alway + default: 'hover' // hover or alway or none }, type: { type: String, @@ -73,6 +73,10 @@ class Swipe extends Component { pauseOnHover: { type: Boolean, default: true + }, + space: { + type: Number, + default: 0 } } @@ -145,6 +149,7 @@ class Swipe extends Component { right: 3%; } .indicator { + z-index: 10; display: flex; align-items: center; justify-content: center; @@ -323,7 +328,7 @@ class Swipe extends Component { }) let toggleBtns = - this.direction === 'horizontal' + this.arrow !== 'none' && this.direction === 'horizontal' ? html`
@@ -446,9 +451,16 @@ class SwipeItem extends Component { } calcCardTranslate(index, activeIndex) { + let space = 0 + if (this.$parent.space) { + space = 0.66 + +this.$parent.space / 100 + } const parentWidth = this.$parent.offsetWidth if (this.inStage) { - return (parentWidth * ((2 - CARD_SCALE) * (index - activeIndex) + 1)) / 4 + return ( + (parentWidth * ((2 + space - CARD_SCALE) * (index - activeIndex) + 1)) / + 4 + ) } else if (index < activeIndex) { return (-(1 + CARD_SCALE) * parentWidth) / 4 } else {