Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | <template> <!-- pe-lg-7 pe-lgxl-lgxl pe-xl-xl--> <div ref="carousel" :id="carouselId" class="carousel slide w-100 position-relative" :style="{'background-color': bgColor}"> <div class="carousel-container"> <div class="carousel-indicators mx-0 position-absolute d-flex justify-content-end justify-content-lg-start mb-lg-0 py-3 px-lg-intermediate px-inter-lg"> <carousel-indicator v-for="index in items.length" @click.native="() => changeSlide(index - 1)" :key="index - 1" :data-bs-slide-to="index - 1" :aria-label="`Slide ${index}`" :data-bs-target="carouselId" :isActive="index - 1 === 0" :aria-current="index - 1 === 0" ></carousel-indicator> </div> <div class="carousel-inner w-100"> <carousel-item v-for="(item, index) in items" :isActive="index === 0" :key="index" :secondaryId="`secondary-carousel${index}`" :item="item" ></carousel-item> </div> </div> </div> </template> <script> import carouselItem from './carousel-item.vue'; import carouselIndicator from './carousel-indicator.vue'; import {mapGetters} from "vuex"; export default { components: {carouselItem, carouselIndicator}, props: ['items', 'bgColor', 'carouselId'], data() { return { carousel: null } }, computed: { ...mapGetters(['isInnerCarouselSliding']) }, watch: { /** * Disables touch for the top level carousel when the inner carousel is sliding * @param {boolean} val * @returns void */ isInnerCarouselSliding(val) { let config = this.carousel._config; config.touch = !val; } }, methods: { /** * Changes slide when user clicks on indicator * @see changeSlide * @param {number} index * @returns void */ changeSlide(index) { this.carousel.to(index); } }, /** * Starts the carousel automatically * @see mounted * @returns void */ async beforeMount(){ }, async mounted() { let {Carousel} = await import('bootstrap'); let myCarousel = this.$refs.carousel; this.carousel = new Carousel(myCarousel, { carousel: 'ride' }); // this.carousel.pause() // override _handleSwipe method from bootstrap in order to check every time if the touch property is enabled or disabled const oldHandleSwipe = this.carousel._handleSwipe.bind(this.carousel); this.carousel._handleSwipe = function () { if (this._config.touch) { oldHandleSwipe(); } } // myCarousel.addEventListener('slid.bs.carousel', () => this.changeCurrentCarouselIndex(0)) //this.carousel.cycle() // // myCarousel.addEventListener('slid.bs.carousel', (e) => { // console.log(e.currentTarget) // }) } } </script> <style lang="scss" scoped> .carousel-container { width: 100%; max-width: calc(50% + 50rem); margin-right: auto; } .carousel { padding-top: 5.4rem; padding-bottom: 5.4rem; } .carousel.pointer-event { touch-action: pan-y pinch-zoom; } .carousel-indicators [data-bs-target] { background-color: rgb(154, 117, 63); width: 0.6rem; height: 0.6rem; border-radius: 100%; } .carousel-indicators { left: 0; bottom: 1.5rem; } //@include media-breakpoint-up(xl) { // .carousel-indicators { // left: 0; // bottom: .3vw; // } //} @media screen and #{$ipad-pro-portrait-breakpoint}, screen and #{$ipad-landscape-breakpoint} { .carousel-indicators [data-bs-target] { width: 30%; height: auto; } .carousel-indicators { justify-content: flex-end !important; width: 4.5rem; top: 50vh; left: calc(100vw - 6.5rem); bottom: auto; height: 4.5rem; } .carousel { padding-top: 0; padding-bottom: 0; } } @media screen and #{$ipad-pro-landscape-breakpoint} { .carousel-indicators [data-bs-target] { width: 30%; height: auto; } .carousel-indicators { justify-content: flex-end !important; width: 4.5rem; top: 50vh; left: calc(100vw - 6.5rem); bottom: auto; height: 4.5rem; } .carousel { padding-top: 0; padding-bottom: 0; } } @include media-breakpoint-down(lg) { .carousel-indicators [data-bs-target] { width: 30%; height: auto; } .carousel-indicators { width: 4.5rem; top: 50vh; left: calc(100vw - 6.5rem); bottom: auto; height: 4.5rem; } .carousel { padding-top: 0; padding-bottom: 0; } } @include media-breakpoint-down(sm) { .carousel-indicators { width: 3rem; top: 50vh; left: calc(100vw - 5rem); height: 4rem; bottom: auto; } } </style> |