yandere_fe/src/components/still-image/still-image.vue

68 lines
1.2 KiB
Vue
Raw Normal View History

2018-01-28 23:47:26 -08:00
<template>
<div class='still-image' :class='{ animated: animated }' >
<canvas ref="canvas" v-if="animated"></canvas>
2019-02-05 07:17:50 -08:00
<img ref="src" :src="src" :referrerpolicy="referrerpolicy" v-on:load="onLoad" @error="onError"/>
2018-01-28 23:47:26 -08:00
</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%;
2018-04-08 16:10:04 -07:00
height: 100%;
2018-04-08 04:46:36 -07:00
&:hover canvas {
display: none;
}
img {
width: 100%;
2018-04-08 16:10:04 -07:00
height: 100%;
2018-09-03 12:49:46 -07:00
object-fit: contain;
}
&.animated {
&:hover::before,
img {
visibility: hidden;
}
&:hover img {
visibility: visible
2018-01-28 23:47:26 -08: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 04:45:12 -07:00
border-radius: $fallback--tooltipRadius;
border-radius: var(--tooltipRadius, $fallback--tooltipRadius);
z-index: 2;
2018-01-28 23:47:26 -08:00
}
}
canvas {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
object-fit: contain;
}
2018-01-28 23:47:26 -08:00
}
</style>