File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33< head >
44 < meta charset ="UTF-8 ">
55 < meta name ="viewport " content ="width=device-width, initial-scale=1 ">
6- < meta name ="google-site-verification " content ="9CIsKebPd-hNdMScya0EZx2Z_GtQ9g3yDXmpbgs2mrU " />
76
87 {{insert basic/stylesheets.html}}
98
Original file line number Diff line number Diff line change 1+ var modal = document . getElementById ( "galleryModal" ) ;
2+ var span = document . getElementsByClassName ( "close" ) [ 0 ] ;
3+ var images = document . querySelectorAll ( ".gallery-img img" ) ;
4+ var originalParent = null ;
5+ var currentImage = null ;
6+
7+ images . forEach ( function ( img ) {
8+ img . style . cursor = "pointer" ;
9+ img . onclick = function ( e ) {
10+ e . preventDefault ( ) ;
11+ modal . style . display = "block" ;
12+ // Move the image to the modal
13+ originalParent = img . parentNode ;
14+ currentImage = img ;
15+ modal . appendChild ( img ) ;
16+ } ;
17+ } ) ;
18+
19+ span . onclick = function ( ) {
20+ modal . style . display = "none" ;
21+ // Move the image back to its original parent
22+ if ( originalParent && currentImage ) {
23+ originalParent . appendChild ( currentImage ) ;
24+ }
25+ } ;
Original file line number Diff line number Diff line change 4444 }
4545}
4646
47+ .gallery-modal {
48+ display : none ;
49+ position : fixed ;
50+ z-index : 1 ;
51+ padding-top : 1% ;
52+ left : 0 ;
53+ top : 0 ;
54+ width : 100% ;
55+ height : 100% ;
56+ overflow : auto ;
57+ background-color : rgba (0 , 0 , 0 , 0.9 );
58+
59+ img {
60+ margin : auto ;
61+ display : block ;
62+ height : 95% ;
63+ width : auto ;
64+ }
65+
66+ .close {
67+ position : absolute ;
68+ top : 15px ;
69+ right : 35px ;
70+ color : #f1f1f1 ;
71+ font-size : 40px ;
72+ font-weight : bold ;
73+ transition : 0.3s ;
74+ }
75+
76+ .close :hover ,
77+ .close :focus {
78+ color : #bbb ;
79+ text-decoration : none ;
80+ cursor : pointer ;
81+ }
82+ }
83+
4784/* Responsive columns */
4885@media (max-width : 1024px ) {
4986 .gallery-wrapper {
6097 .gallery-img img {
6198 height : 160px ; /* slightly smaller on mobile */
6299 }
100+
101+ .gallery-modal {
102+ padding-top : 20% ;
103+
104+ img {
105+ width : 80% ;
106+ height : auto ;
107+ }
108+ }
63109}
Original file line number Diff line number Diff line change @@ -22,12 +22,6 @@ function add_gallery_item(io, obj::GalleryItem)
2222 )
2323end
2424
25- function parse_gallery_item (item)
26-
27-
28- obj
29- end
30-
3125@lx function makeGallery (img_dir)
3226 io = IOBuffer ()
3327
5448
5549 write (io, " </div>" )
5650
51+ write (
52+ io,
53+ """
54+ <div id="galleryModal" class="gallery-modal">
55+ <span class="close">×</span>
56+ </div>
57+ """
58+ )
59+
60+ write (io, """ <script src="/libs/scripts/gallery-modal.js"></script>""" )
61+
5762 take! (io) |> String |> html
5863end
You can’t perform that action at this time.
0 commit comments