2018-01-29 07:47:26 +00:00
|
|
|
<template>
|
|
|
|
<div class='still-image' :class='{ animated: animated }' >
|
|
|
|
<canvas ref="canvas" v-if="animated"></canvas>
|
2018-02-03 16:55:45 +00:00
|
|
|
<img ref="src" :src="src" :referrerpolicy="referrerpolicy" v-on:load="onLoad"/>
|
2018-01-29 07:47:26 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script src="./still-image.js"></script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@import '../../_variables.scss';
|
|
|
|
.still-image {
|
2018-04-07 18:58:29 +00:00
|
|
|
position: relative;
|
|
|
|
line-height: 0;
|
|
|
|
overflow: hidden;
|
|
|
|
width: 100%;
|
2018-04-08 23:10:04 +00:00
|
|
|
height: 100%;
|
2018-03-11 23:31:33 +00:00
|
|
|
|
2018-04-08 11:46:36 +00:00
|
|
|
&:hover canvas {
|
2018-04-07 18:58:29 +00:00
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
img {
|
|
|
|
width: 100%;
|
2018-04-08 23:10:04 +00:00
|
|
|
height: 100%;
|
2018-04-07 18:58:29 +00:00
|
|
|
}
|
2018-03-11 23:31:33 +00:00
|
|
|
|
2018-04-07 18:58:29 +00:00
|
|
|
&.animated {
|
|
|
|
&:hover::before,
|
2018-03-11 23:31:33 +00:00
|
|
|
img {
|
2018-04-07 18:58:29 +00:00
|
|
|
visibility: hidden;
|
2018-03-11 23:31:33 +00:00
|
|
|
}
|
|
|
|
|
2018-04-07 18:58:29 +00:00
|
|
|
&:hover img {
|
|
|
|
visibility: visible
|
2018-01-29 07:47:26 +00:00
|
|
|
}
|
|
|
|
|
2018-04-07 18:58:29 +00:00
|
|
|
&::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;
|
2018-04-08 11:45:12 +00:00
|
|
|
border-radius: $fallback--tooltipRadius;
|
|
|
|
border-radius: var(--tooltipRadius, $fallback--tooltipRadius);
|
2018-04-07 18:58:29 +00:00
|
|
|
z-index: 2;
|
2018-01-29 07:47:26 +00:00
|
|
|
}
|
2018-04-07 18:58:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
canvas {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
2018-08-27 19:40:30 +00:00
|
|
|
object-fit: contain;
|
2018-04-07 18:58:29 +00:00
|
|
|
}
|
2018-01-29 07:47:26 +00:00
|
|
|
}
|
|
|
|
</style>
|