File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -37,3 +37,24 @@ export function insertBgImages() {
37
37
}
38
38
}
39
39
}
40
+
41
+ export function initModals ( ) {
42
+ let targets = document . querySelectorAll ( ".modal-trigger" ) ;
43
+ if ( typeof targets != "undefined" && targets != null ) {
44
+ for ( var i = 0 , len = targets . length ; i < len ; i ++ ) {
45
+ targets [ i ] . addEventListener ( 'click' , function ( event ) {
46
+ var modalID = this . getAttribute ( 'data-modal' ) ;
47
+ document . querySelector ( '#' + modalID ) . classList . add ( 'is-active' ) ;
48
+ } )
49
+ }
50
+ }
51
+
52
+ targets = document . querySelectorAll ( ".modal-close" ) ;
53
+ if ( typeof targets != "undefined" && targets != null ) {
54
+ for ( var i = 0 , len = targets . length ; i < len ; i ++ ) {
55
+ targets [ i ] . addEventListener ( 'click' , function ( event ) {
56
+ this . closest ( '.modal' ) . classList . remove ( 'is-active' ) ;
57
+ } )
58
+ }
59
+ }
60
+ }
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import './store/store';
4
4
import 'alpinejs' ;
5
5
import { env } from './libs/utils/constants' ;
6
6
import { initPageLoader } from './libs/components/pageloader' ;
7
- import { switchDemoImages , insertBgImages } from './libs/utils/utils' ;
7
+ import { switchDemoImages , insertBgImages , initModals } from './libs/utils/utils' ;
8
8
import { initNavbar } from './libs/components/navbar' ;
9
9
import { initSidebar } from './libs/components/sidebar' ;
10
10
import { initBackToTop } from './libs/components/backtotop' ;
@@ -28,6 +28,8 @@ document.onreadystatechange = function () {
28
28
//Feather Icons
29
29
const featherIcons = feather . replace ( ) ;
30
30
31
+ // Add modal windows
32
+ const modals = initModals ( ) ;
31
33
}
32
34
}
33
35
You can’t perform that action at this time.
0 commit comments