aboutsummaryrefslogtreecommitdiff
path: root/src/components/still-image/still-image.vue
blob: 5fefe714494930740ade5b84fefc4cd4f0458773 (plain)
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
<template>
  <div class='still-image' :class='{ animated: animated }' >
    <canvas ref="canvas" v-if="animated"></canvas>
    <img ref="src" :src="src" :referrerpolicy="referrerpolicy" v-on:load="onLoad"/>
  </div>
</template>

<script src="./still-image.js"></script>

<style lang="scss">
@import '../../_variables.scss';
.still-image {
  position: relative;
  line-height: 0;
  overflow: hidden;
  width: 100%;
  height: 100%

  &:hover canvas {
    display: none;
  }

  img {
    width: 100%;
    height: 100%
  }

  &.animated {
    &:hover::before,
    img {
      visibility: hidden;
    }

    &:hover img {
      visibility: visible
    }

    &::before {
      content: 'gif';
      position: absolute;
      line-height: 10px;
      font-size: 10px;
      top: 5px;
      left: 5px;
      background: rgba(127,127,127,.5);
      color: #FFF;
      display: block;
      padding: 2px 4px;
      border-radius: 3px;
      z-index: 2;
    }
  }

  canvas {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
  }
}
</style>