|
1 | 1 | <template>
|
2 |
| - <div class="agile" :class="{'agile--fade': settings.fade}"> |
| 2 | + <div class="agile" |
| 3 | + :class="{'agile--fade': settings.fade && !settings.unagile, 'agile--disabled': settings.unagile}"> |
3 | 4 | <div ref="list" class="agile__list">
|
4 | 5 | <div ref="track" class="agile__track"
|
5 | 6 | :style="{width: width.track + 'px', transform: 'translate(-' + transform + 'px)', transition: 'transform ' + settings.timing + ' ' + transitionDelay + 'ms'}"
|
|
228 | 229 | getWidth () {
|
229 | 230 | this.width = {
|
230 | 231 | document: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
|
231 |
| - container: !this.settings.unagile ? this.$refs.list.clientWidth : 'auto', |
| 232 | + container: this.$refs.list.clientWidth, |
232 | 233 | slide: !this.settings.unagile ? this.$refs.list.clientWidth / this.slidesToShow : 'auto'
|
233 | 234 | }
|
234 | 235 | },
|
|
325 | 326 | },
|
326 | 327 |
|
327 | 328 | countSlides () {
|
328 |
| - if (this.settings.infinite && !this.settings.fade) { |
| 329 | + if (this.settings.infinite && !this.settings.fade && !this.settings.unagile) { |
329 | 330 | this.allSlidesCount = this.slidesCount + 2
|
330 | 331 | } else {
|
331 | 332 | this.allSlidesCount = this.slidesCount
|
|
365 | 366 | },
|
366 | 367 |
|
367 | 368 | setSlide (n, transition = true, autoplayTimeout = true) {
|
| 369 | + if (this.settings.unagile) { |
| 370 | + return false |
| 371 | + } |
| 372 | +
|
368 | 373 | // Reset autoplay timeout and set new
|
369 | 374 | if (this.settings.autoplay && autoplayTimeout) {
|
370 | 375 | this.stopAutoplay()
|
|
480 | 485 | }
|
481 | 486 |
|
482 | 487 | // Check infinity mode status and enable/disable
|
483 |
| - if (this.settings.infinite && !this.settings.fade) { |
| 488 | + if (this.settings.infinite && !this.settings.fade && !this.settings.unagile) { |
484 | 489 | this.enableInfiniteMode()
|
485 | 490 | } else {
|
486 | 491 | this.disableInfiniteMode()
|
|
491 | 496 | this.enableAutoplayMode()
|
492 | 497 | }
|
493 | 498 |
|
494 |
| - if (!this.settings.autoplay && this.autoplayStatus) { |
| 499 | + if ((!this.settings.autoplay && this.autoplayStatus) || this.settings.unagile) { |
495 | 500 | this.disableAutoplayMode()
|
496 | 501 | }
|
497 | 502 |
|
|
500 | 505 | this.slides[i].style.width = this.width.container + 'px'
|
501 | 506 |
|
502 | 507 | // Prepare slides for fade mode
|
503 |
| - if (this.settings.fade) { |
| 508 | + if (this.settings.fade && !this.settings.unagile) { |
504 | 509 | this.slides[i].style.transform = 'translate(-' + i * this.width.slide + 'px)'
|
505 | 510 | } else {
|
506 | 511 | this.slides[i].style.transform = 'translate(0)'
|
507 | 512 | }
|
508 | 513 | }
|
509 | 514 |
|
510 | 515 | // Prepare track
|
511 |
| - this.width.track = this.width.container * this.allSlidesCount |
512 |
| - this.setSlide(this.currentSlide, false, false) |
| 516 | + if (this.settings.unagile) { |
| 517 | + this.width.track = this.width.container |
| 518 | + this.transform = 0 |
| 519 | + } else { |
| 520 | + this.width.track = this.width.container * this.allSlidesCount |
| 521 | + this.setSlide(this.currentSlide, false, false) |
| 522 | + } |
513 | 523 | },
|
514 | 524 |
|
515 | 525 | dragDistance () {
|
516 |
| - if (!this.mouseDown) { |
517 |
| - return |
518 |
| - } |
519 |
| -
|
520 | 526 | if (this.dragDistance > this.swipeDistance) {
|
521 | 527 | if (!this.settings.infinite && this.currentSlide === 0) {
|
522 | 528 | return
|
|
562 | 568 | align-items: center;
|
563 | 569 | display: flex;
|
564 | 570 | justify-content: flex-start;
|
| 571 | +
|
| 572 | + .agile--disabled & { |
| 573 | + display: block; |
| 574 | + } |
565 | 575 | }
|
566 | 576 |
|
567 | 577 | &__slide {
|
|
0 commit comments