-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #408 from ismail9k/pr-388
Feat: Support Ability to Breakpoints Relative to The Carousel Width
- Loading branch information
Showing
22 changed files
with
14,247 additions
and
1,905 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,65 @@ | ||
<script setup> | ||
import { Carousel, Pagination, Navigation, Slide } from '../../dist/carousel.es' | ||
import '../../dist/carousel.css' | ||
const config = { | ||
itemsToShow: 3.95, | ||
wrapAround: true, | ||
transition: 500, | ||
} | ||
</script> | ||
|
||
<template> | ||
<Carousel id="activeClasses" :itemsToShow="3.95" :wrapAround="true" :transition="500"> | ||
<Carousel v-bind="config"> | ||
<Slide v-for="slide in 10" :key="slide"> | ||
<div class="carousel__item">{{ slide }}</div> | ||
</Slide> | ||
|
||
<template #addons> | ||
<Navigation /> | ||
<Pagination /> | ||
</template> | ||
</Carousel> | ||
</template> | ||
|
||
<script> | ||
import { defineComponent } from 'vue' | ||
import { Carousel, Pagination, Navigation, Slide } from '../../dist/carousel.es' | ||
|
||
import '../../dist/carousel.css' | ||
export default defineComponent({ | ||
name: 'Basic', | ||
components: { | ||
Carousel, | ||
Slide, | ||
Pagination, | ||
Navigation, | ||
}, | ||
}) | ||
</script> | ||
|
||
<style lang="stylus"> | ||
#activeClasses { | ||
.carousel__slide { | ||
padding: 5; | ||
} | ||
<style lang="stylus" scoped> | ||
.carousel__slide { | ||
padding: 5; | ||
} | ||
.carousel__viewport { | ||
perspective: 2000px; | ||
} | ||
.carousel__viewport { | ||
perspective: 2000px; | ||
} | ||
.carousel__track { | ||
transform-style: preserve-3d; | ||
} | ||
.carousel__track { | ||
transform-style: preserve-3d; | ||
} | ||
.carousel__slide--sliding { | ||
transition: 0.5s; | ||
} | ||
.carousel__slide--sliding { | ||
transition: 0.5s; | ||
} | ||
.carousel__slide { | ||
opacity: 0.9; | ||
transform: rotateY(-20deg) scale(0.9); | ||
} | ||
.carousel__slide { | ||
opacity: 0.9; | ||
transform: rotateY(-20deg) scale(0.9); | ||
} | ||
.carousel__slide--active ~ .carousel__slide { | ||
transform: rotateY(20deg) scale(0.9); | ||
} | ||
.carousel__slide--active ~ .carousel__slide { | ||
transform: rotateY(20deg) scale(0.9); | ||
} | ||
.carousel__slide--prev { | ||
opacity: 1; | ||
transform: rotateY(-10deg) scale(0.95); | ||
} | ||
.carousel__slide--prev { | ||
opacity: 1; | ||
transform: rotateY(-10deg) scale(0.95); | ||
} | ||
.carousel__slide.carousel__slide--next { | ||
opacity: 1; | ||
transform: rotateY(10deg) scale(0.95); | ||
} | ||
.carousel__slide.carousel__slide--next { | ||
opacity: 1; | ||
transform: rotateY(10deg) scale(0.95); | ||
} | ||
.carousel__slide--active { | ||
opacity: 1; | ||
transform: rotateY(0) scale(1); | ||
} | ||
.carousel__slide--active { | ||
opacity: 1; | ||
transform: rotateY(0) scale(1); | ||
} | ||
</style> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,23 @@ | ||
<script setup> | ||
import '../../dist/carousel.css' | ||
import { Carousel, Slide, Navigation } from '../../dist/carousel.es' | ||
const config = { | ||
autoplay: 2000, | ||
wrapAround: true, | ||
pauseAutoplayOnHover: true, | ||
} | ||
</script> | ||
|
||
<template> | ||
<Carousel :autoplay="2000" :wrap-around="true" pause-autoplay-on-hover> | ||
<Carousel v-bind="config"> | ||
<Slide v-for="slide in 10" :key="slide"> | ||
<div class="carousel__item">{{ slide }}</div> | ||
</Slide> | ||
|
||
<template #addons> | ||
<Pagination /> | ||
<Navigation /> | ||
</template> | ||
</Carousel> | ||
</template> | ||
|
||
<script> | ||
import { defineComponent } from 'vue' | ||
import { Carousel, Pagination, Slide } from '../../dist/carousel.es' | ||
import '../../dist/carousel.css' | ||
export default defineComponent({ | ||
name: 'Autoplay', | ||
components: { | ||
Carousel, | ||
Slide, | ||
Pagination, | ||
}, | ||
}) | ||
</script> |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,54 @@ | ||
<template> | ||
<Carousel v-bind="settings" :breakpoints="breakpoints"> | ||
<Slide v-for="slide in 10" :key="slide"> | ||
<div class="carousel__item">{{ slide }}</div> | ||
</Slide> | ||
|
||
<template #addons> | ||
<Navigation /> | ||
</template> | ||
</Carousel> | ||
</template> | ||
|
||
<script> | ||
import { defineComponent } from 'vue' | ||
<script setup> | ||
import { Carousel, Navigation, Slide } from '../../dist/carousel.es' | ||
import '../../dist/carousel.css' | ||
export default defineComponent({ | ||
name: 'Breakpoints', | ||
components: { | ||
Carousel, | ||
Slide, | ||
Navigation, | ||
}, | ||
data: () => ({ | ||
// carousel settings | ||
settings: { | ||
itemsToShow: 1, | ||
// Carousel configuration | ||
const config = { | ||
itemsToShow: 1, | ||
snapAlign: 'center', | ||
// 'breakpointMode' determines how the carousel breakpoints are calculated | ||
// Acceptable values: 'viewport' (default) | 'carousel' | ||
// 'viewport' - breakpoints are based on the viewport width | ||
// 'carousel' - breakpoints are based on the carousel width | ||
breakpointMode: 'carousel', | ||
// Breakpoints are mobile-first | ||
// Any settings not specified will fall back to the carousel's default settings | ||
breakpoints: { | ||
// 300px and up | ||
300: { | ||
itemsToShow: 2, | ||
snapAlign: 'center', | ||
}, | ||
// breakpoints are mobile first | ||
// any settings not specified will fallback to the carousel settings | ||
breakpoints: { | ||
// 700px and up | ||
700: { | ||
itemsToShow: 3.5, | ||
snapAlign: 'center', | ||
}, | ||
// 1024 and up | ||
1024: { | ||
itemsToShow: 5, | ||
snapAlign: 'start', | ||
}, | ||
// 400px and up | ||
400: { | ||
itemsToShow: 3, | ||
snapAlign: 'start', | ||
}, | ||
}), | ||
}) | ||
// 500px and up | ||
500: { | ||
itemsToShow: 4, | ||
snapAlign: 'start', | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<template> | ||
<!-- Resizable container for testing 'carousel' breakpointMode --> | ||
<!-- Drag the right edge to adjust the width and see the breakpoints change --> | ||
<div style="resize: horizontal; border: 2px dashed gray; overflow: auto"> | ||
<Carousel v-bind="config"> | ||
<Slide v-for="slide in 10" :key="slide"> | ||
<div class="carousel__item">{{ slide }}</div> | ||
</Slide> | ||
<template #addons> | ||
<Navigation /> | ||
</template> | ||
</Carousel> | ||
</div> | ||
</template> | ||
|
||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.