Skip to content
This repository was archived by the owner on Nov 4, 2022. It is now read-only.

Commit e98b128

Browse files
committed
Add magnific popup for image
1 parent 405b31c commit e98b128

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

_includes/footer.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ <h4>Our Network</h4>
9595
<path d="M128 768h256v64H128v-64z m320-384H128v64h320v-64z m128 192V448L384 640l192 192V704h320V576H576z m-288-64H128v64h160v-64zM128 704h160v-64H128v64z m576 64h64v128c-1 18-7 33-19 45s-27 18-45 19H64c-35 0-64-29-64-64V192c0-35 29-64 64-64h192C256 57 313 0 384 0s128 57 128 128h192c35 0 64 29 64 64v320h-64V320H64v576h640V768zM128 256h512c0-35-29-64-64-64h-64c-35 0-64-29-64-64s-29-64-64-64-64 29-64 64-29 64-64 64h-64c-35 0-64 29-64 64z" />
9696
</symbol>
9797
</svg>
98-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2.5.2/dist/cdn/docsearch.min.css" media="print" onload="this.media='all'">
99-
<script src="https://cdn.jsdelivr.net/combine/npm/docsearch.js@2.5.2/dist/cdn/docsearch.min.js,npm/[email protected].1,npm/tocbot@4.3.2/dist/tocbot.min.js"></script>
98+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/combine/npm/docsearch.js@2.6.3/dist/cdn/docsearch.min.css,npm/[email protected]/dist/magnific-popup.min.css" media="print" onload="this.media='all'">
99+
<script src="https://cdn.jsdelivr.net/combine/npm/[email protected],npm/[email protected],npm/docsearch.js@2.6.3/dist/cdn/docsearch.min.js,npm/[email protected].6,npm/tocbot@4.12.0/dist/tocbot.min.js"></script>
100100
<script src="/assets/script.js"></script>
101101
</body>
102102
</html>

_sass/content.scss

+5
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@
105105
}
106106
.entry-content img {
107107
box-shadow: 0 0 2px rgba(0, 0, 0, .3);
108+
cursor: zoom-in;
109+
transition: all .2s;
110+
&:hover {
111+
filter: brightness(.5);
112+
}
108113
}
109114
.button--copy {
110115
opacity: 0;

assets/script.js

+9
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ function copyToClipboard() {
9292
});
9393
}
9494

95+
function popupImage() {
96+
$( '.entry-content img' ).each( function() {
97+
const $img = $( this );
98+
$img.attr( 'data-mfp-src', $img.attr( 'src' ) );
99+
$img.magnificPopup( { type: 'image' } );
100+
} );
101+
}
102+
95103
docsearch({
96104
apiKey: '97cd82eb9fd8fdde822c2a66377779a0',
97105
indexName: 'metabox',
@@ -103,3 +111,4 @@ toggleMobileMenu();
103111
toggleDocsMenu();
104112
generateTOC();
105113
copyToClipboard();
114+
popupImage();

0 commit comments

Comments
 (0)