mirror of https://github.com/ElemeFE/element
Carousel: apply infinite sliding in non-card mode (#2622)
parent
58195fc69d
commit
7628fc0e41
|
@ -70,11 +70,10 @@
|
|||
translateItem(index, activeIndex) {
|
||||
const parentWidth = this.$parent.$el.offsetWidth;
|
||||
const length = this.$parent.items.length;
|
||||
|
||||
if (index !== activeIndex && length > 2) {
|
||||
index = this.processIndex(index, activeIndex, length);
|
||||
}
|
||||
if (this.$parent.type === 'card') {
|
||||
if (index !== activeIndex && length > 2) {
|
||||
index = this.processIndex(index, activeIndex, length);
|
||||
}
|
||||
this.inStage = Math.round(Math.abs(index - activeIndex)) <= 1;
|
||||
this.active = index === activeIndex;
|
||||
this.translate = this.calculateTranslate(index, activeIndex, parentWidth);
|
||||
|
|
|
@ -13,10 +13,13 @@
|
|||
display: inline-block;
|
||||
transition: .4s ease-in-out;
|
||||
overflow: hidden;
|
||||
z-index: calc(var(--index-normal) - 1);
|
||||
@when active {
|
||||
z-index: calc(var(--index-normal) + 1);
|
||||
}
|
||||
|
||||
@modifier card {
|
||||
width: 50%;
|
||||
z-index: calc(var(--index-normal) - 1);
|
||||
&.is-in-stage {
|
||||
cursor: pointer;
|
||||
z-index: var(--index-normal);
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
transform: translateX(-50%);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
z-index: calc(var(--index-normal) + 1);
|
||||
|
||||
@modifier outside {
|
||||
bottom: calc(var(--carousel-indicator-height) + var(--carousel-indicator-padding-vertical) * 2);
|
||||
|
|
Loading…
Reference in New Issue