File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,10 @@ <h3>Table of contents</h3>
138
138
{% endif %}
139
139
</ div >
140
140
</ div >
141
+
142
+ < div class ="popup " id ="popup " onclick ="closePopup() ">
143
+ < div id ="content "> </ div >
144
+ </ div >
141
145
</ main >
142
146
143
147
</ body >
@@ -154,5 +158,24 @@ <h3>Table of contents</h3>
154
158
section . querySelector ( 'img' ) . src = '/images/icons/nav-chevron-down.png' ;
155
159
}
156
160
}
161
+
162
+ const popover = document . getElementById ( 'content' ) ;
163
+ const scalable = document . getElementsByClassName ( 'scalable-image' ) ;
164
+ for ( const scalableElement of scalable ) {
165
+ scalableElement . addEventListener ( 'click' , ( ) => {
166
+ const image = scalableElement . getElementsByTagName ( 'img' ) [ 0 ] ;
167
+ const title = ( ) => image . alt ? `<h1>${ image . alt } </h1>` : ''
168
+
169
+ popover . innerHTML = `${ title ( ) } ${ image . outerHTML } `
170
+
171
+ document . getElementById ( 'popup' )
172
+ . classList . add ( 'open' )
173
+ } )
174
+ }
175
+
176
+ function closePopup ( ) {
177
+ document . getElementById ( 'popup' )
178
+ . classList . remove ( 'open' )
179
+ }
157
180
</ script >
158
181
</ html >
Original file line number Diff line number Diff line change 36
36
37
37
& .open {
38
38
display : flex ;
39
+ justify-content : center ;
39
40
}
40
41
}
41
42
Original file line number Diff line number Diff line change 63
63
@import " section-layout/page-navigation" ;
64
64
}
65
65
}
66
+
67
+ @import " popover" ;
66
68
}
67
69
}
68
70
You can’t perform that action at this time.
0 commit comments