akkoma-fe/src/components/still-image/still-image.vue

63 lines
1.2 KiB
Vue
Raw Normal View History

2018-01-29 07:47:26 +00:00
<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"/>
2018-01-29 07:47:26 +00:00
</div>
</template>
<script src="./still-image.js"></script>
<style lang="scss">
@import '../../_variables.scss';
.still-image {
position: relative;
line-height: 0;
overflow: hidden;
2018-01-29 07:47:26 +00:00
&:hover canvas {
display: none;
}
img {
width: 100%;
height: 100%
}
2018-01-29 07:47:26 +00:00
&.animated {
&:hover::before,
img {
visibility: hidden;
2018-01-29 07:47:26 +00:00
}
2018-01-29 07:47:26 +00:00
&:hover img {
visibility: visible
}
&::before {
content: 'gif';
position: absolute;
2018-02-03 17:37:27 +00:00
line-height: 10px;
font-size: 10px;
2018-01-29 07:47:26 +00:00
top: 5px;
left: 5px;
2018-02-03 17:37:27 +00:00
background: rgba(127,127,127,.5);
color: #FFF;
2018-01-29 07:47:26 +00:00
display: block;
2018-02-03 17:37:27 +00:00
padding: 2px 4px;
border-radius: 3px;
2018-01-29 07:47:26 +00:00
z-index: 2;
}
}
canvas {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
}
}
</style>