feat: 增加隐藏图片功能

pull/627/head
Clansty 2022-08-22 00:51:59 +08:00
parent 2cab0ee1cf
commit 23057284b2
4 changed files with 43 additions and 3 deletions

View File

@ -24,3 +24,7 @@ document.addEventListener(
},
{ capture: true },
);
function showHiddenPhoto(elem) {
elem.classList.add('show');
}

View File

@ -164,3 +164,37 @@ a.anchor {
.footer__contents {
text-align: left;
}
div.hidden-photo {
position: relative;
overflow: hidden;
border: 1px solid #ccc;
border-radius: 0.25rem;
img {
transition: filter 0.3s;
filter: blur(25px);
}
.mask {
position: absolute;
z-index: 1;
top: 0; bottom: 0; left: 0; right: 0;
background-color: rgba($color: #000000, $alpha: 0.5);
transition: opacity 0.3s;
opacity: 1;
&::before {
content: '点击查看';
color: white;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
}
&.show {
img {
filter: blur(0);
}
.mask {
opacity: 0;
}
}
}

View File

@ -172,9 +172,7 @@ keywords:
## 术后评价
- 2021 年 6 月手术,术后 7 个月拍摄:
{{< expand "" >}}
![srs-photo](postoperative-1.jpg)
{{< /expand >}}
{{< hiddenphoto "postoperative-1.jpg" >}}
## 其他事项

View File

@ -0,0 +1,4 @@
<div class="hidden-photo" onclick="showHiddenPhoto(this)">
<img src="{{ .Get 0 }}" alt="{{ .Get 1 }}">
<div class="mask"></div>
</div>