2018-01-29 18:47:26 +11:00
|
|
|
<template>
|
|
|
|
<div class='still-image' :class='{ animated: animated }' >
|
|
|
|
<canvas ref="canvas" v-if="animated"></canvas>
|
2018-02-04 03:55:45 +11:00
|
|
|
<img ref="src" :src="src" :referrerpolicy="referrerpolicy" v-on:load="onLoad"/>
|
2018-01-29 18:47:26 +11:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script src="./still-image.js"></script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@import '../../_variables.scss';
|
|
|
|
.still-image {
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
&:hover canvas {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.animated {
|
|
|
|
&:hover::before,
|
|
|
|
img {
|
|
|
|
visibility: hidden
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover img {
|
|
|
|
visibility: visible
|
|
|
|
}
|
|
|
|
|
|
|
|
&::before {
|
|
|
|
content: 'gif';
|
|
|
|
position: absolute;
|
|
|
|
top: 5px;
|
|
|
|
left: 5px;
|
2018-02-04 03:55:45 +11:00
|
|
|
background: rgba(127,127,127,.7);
|
2018-01-29 18:47:26 +11:00
|
|
|
display: block;
|
|
|
|
padding: 2px;
|
2018-02-04 03:55:45 +11:00
|
|
|
border-radius: 3px;
|
2018-01-29 18:47:26 +11:00
|
|
|
z-index: 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
canvas {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|