All files / src/carousel-3d Controls.vue

100% Statements 1/1
100% Branches 0/0
100% Functions 1/1
100% Lines 1/1

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                                                                                                      5x                                                                                                                      
<template>
  <div class="carousel-3d-controls">
    <a href="#" class="prev" @click.prevent="parent.goPrev()"
       :class="{ disabled: !parent.isPrevPossible }"
       :style="`width: ${width}px; height: ${height}px; line-height: ${height}px;`"
       aria-label="Previous slide">
      <span v-html="prevHtml"></span>
    </a>
    <a href="#" class="next" @click.prevent="parent.goNext()"
       :class="{ disabled: !parent.isNextPossible }"
       :style="`width: ${width}px; height: ${height}px; line-height: ${height}px;`"
       aria-label="Next slide">
      <span v-html="nextHtml"></span>
    </a>
  </div>
</template>
 
<script>
export default {
  name: 'controls',
  props: {
    /**
     * Width in pixels of the navigation buttons
     */
    width: {
      type: [String, Number],
      default: 50
    },
    /**
     * Height in pixels of the navigation buttons
     */
    height: {
      type: [String, Number],
      default: 60
    },
    /**
     * Text content of the navigation prev button
     */
    prevHtml: {
      type: String,
      default: '&lsaquo;'
    },
    /**
     * Text content of the navigation next button
     */
    nextHtml: {
      type: String,
      default: '&rsaquo;'
    }
  },
  data () {
    return {
      parent: this.$parent
    }
  }
}
</script>
 
<style scoped>
.carousel-3d-controls {
  position: absolute;
  top: 50%;
  height: 0;
  margin-top: -30px;
  left: 0;
  width: 100%;
  z-index: 1000;
}
 
.next, .prev {
  width: 60px;
  position: absolute;
  z-index: 1010;
  font-size: 60px;
  height: 60px;
  line-height: 60px;
  color: #333;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  text-decoration: none;
  top: 0;
}
 
.next:hover, .prev:hover {
  cursor: pointer;
  opacity: 0.7;
}
 
.prev {
  left: 10px;
  text-align: left;
}
 
.next {
  right: 10px;
  text-align: right;
}
 
.disabled {
  opacity: 0.2;
  cursor: default;
}
 
.disabled:hover {
  cursor: default;
  opacity: 0.2;
}
</style>