Skip to content

Commit 83cfbf3

Browse files
committed
feat(img): setup Viewer.js to image for convenience
Ref: https://github.com/fengyuanchen/viewerjs/tree/main
1 parent d29d725 commit 83cfbf3

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

themes/simplecss/layouts/partials/footer.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,15 @@
2121
{{- if not .Site.IsServer -}}
2222
{{ template "_internal/google_analytics.html" . }}
2323
{{- end -}}
24+
25+
<!-- ViewerJS -->
26+
<script src="https://cdnjs.cloudflare.com/ajax/libs/viewerjs/1.11.6/viewer.min.js" integrity="sha512-EC3CQ+2OkM+ZKsM1dbFAB6OGEPKRxi6EDRnZW9ys8LghQRAq6cXPUgXCCujmDrXdodGXX9bqaaCRtwj4h4wgSQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
27+
<script>
28+
const gallery = new Viewer(
29+
document.querySelector("article > div:nth-child(2)"),
30+
{
31+
toolbar: false,
32+
initialCoverage: 1
33+
}
34+
);
35+
</script>

themes/simplecss/layouts/partials/head.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,8 @@
2929
<link rel="stylesheet" href="{{ "css/customize.css" | absURL }}">
3030
{{ partial "json-sitename.html" . }}
3131

32+
<!-- ViewerJS -->
33+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/viewerjs/1.11.6/viewer.min.css" integrity="sha512-za6IYQz7tR0pzniM/EAkgjV1gf1kWMlVJHBHavKIvsNoUMKWU99ZHzvL6lIobjiE2yKDAKMDSSmcMAxoiWgoWA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
34+
3235
<link rel="canonical" href="{{ .Permalink }}" />
3336
</head>

themes/simplecss/static/css/customize.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ a:hover {
1717
.site-header {
1818
font-size: xx-large;
1919
}
20+
21+
/* Refine Image */
22+
img {
23+
opacity: 1;
24+
}

0 commit comments

Comments
 (0)