File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -13,12 +13,21 @@ const scrollbarWidthCssVar = "--pico-scrollbar-width";
1313const animationDuration = 400 ; // ms
1414let visibleModal = null ;
1515
16+
1617// Toggle modal
1718const toggleModal = ( event ) => {
1819 event . preventDefault ( ) ;
1920 const modal = document . getElementById ( event . currentTarget . dataset . target ) ;
2021 if ( ! modal ) return ;
21- modal && ( modal . open ? closeModal ( modal ) : openModal ( modal ) ) ;
22+ if ( event . currentTarget . dataset . close ) {
23+ const modalClose = document . getElementById ( event . currentTarget . dataset . close ) ;
24+ if ( modalClose ) {
25+ closeModal ( modalClose ) ;
26+ setTimeout ( ( ) => modal && ( modal . open ? closeModal ( modal ) : openModal ( modal ) ) , animationDuration ) ;
27+ }
28+ } else {
29+ modal && ( modal . open ? closeModal ( modal ) : openModal ( modal ) ) ;
30+ }
2231} ;
2332
2433// Open modal
You can’t perform that action at this time.
0 commit comments