Arrow.vue 1.46 KB
<template>
  <div>
    <!-- 左箭头 开始   -->
    <div class="left_arrow">
      <img src="@/assets/images/arrow_left.png" class="img" alt="" />
      <img src="@/assets/images/arrow_circle.png" class="circle" alt="" />
    </div>
    <!-- 左箭头 end   -->

    <!-- 右箭头 开始   -->
    <div class="right_arrow">
      <img src="@/assets/images/arrow_right.png" class="img" alt="" />
      <img src="@/assets/images/arrow_circle.png" class="circle" alt="" />
    </div>
    <!-- 右箭头 end   -->
  </div>
</template>
<script>
export default {
  name: 'FixedArrow',
  data() {
    return {}
  }
}
</script>
<style lang="scss" scoped>
.left_arrow,
.right_arrow {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 10;
  width: 100px;
  .img {
    width: 48px;
    height: 48px;
    opacity: 0;
    cursor: pointer;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 12;
  }
  .circle {
    width: 84px;
    height: 84px;
    position: fixed;
    top: 50%;
    // transform: translateY(-50%);
    margin-top: -42px;
    z-index: 11;
    opacity: 0;
  }
}
.left_arrow {
  left: 0;
  .img {
    left: 18px;
  }
  .circle {
    left: 0;
  }
}
.right_arrow {
  right: 0;
  .img {
    right: 18px;
  }
  .circle {
    right: 0;
  }
}
.left_arrow:hover,
.right_arrow:hover {
  .img {
    opacity: 1;
  }
  .circle {
    opacity: 1;
    animation: rotate360 1.2s ease-out 0s;
  }
}
@keyframes rotate360 {
  100% {
    transform: rotate(360deg);
  }
}
</style>