1
+ // JavaScript Document
2
+
3
+ $ ( document ) . ready ( function ( ) {
4
+ "use strict" ;
5
+
6
+ var window_width = $ ( window ) . width ( ) ,
7
+ window_height = window . innerHeight ,
8
+ header_height = $ ( ".default-header" ) . height ( ) ,
9
+ header_height_static = $ ( ".site-header.static" ) . outerHeight ( ) ,
10
+ fitscreen = window_height - header_height ;
11
+
12
+ $ ( ".fullscreen" ) . css ( "height" , window_height )
13
+ $ ( ".fitscreen" ) . css ( "height" , fitscreen ) ;
14
+
15
+ if ( document . getElementById ( "default-select" ) ) {
16
+ $ ( 'select' ) . niceSelect ( ) ;
17
+ } ;
18
+ if ( document . getElementById ( "service-select" ) ) {
19
+ $ ( 'select' ) . niceSelect ( ) ;
20
+ } ;
21
+
22
+ $ ( '.img-gal' ) . magnificPopup ( {
23
+ type : 'image' ,
24
+ gallery : {
25
+ enabled : true
26
+ }
27
+ } ) ;
28
+
29
+ $ ( '.img-pop-up' ) . magnificPopup ( {
30
+ type : 'image' ,
31
+ gallery : {
32
+ enabled : true
33
+ }
34
+ } ) ;
35
+
36
+ $ ( '.play-btn' ) . magnificPopup ( {
37
+ type : 'iframe' ,
38
+ mainClass : 'mfp-fade' ,
39
+ removalDelay : 160 ,
40
+ preloader : false ,
41
+ fixedContentPos : false
42
+ } ) ;
43
+
44
+
45
+
46
+ // Initiate superfish on nav menu
47
+ $ ( '.nav-menu' ) . superfish ( {
48
+ animation : {
49
+ opacity : 'show'
50
+ } ,
51
+ speed : 400
52
+ } ) ;
53
+
54
+ // Mobile Navigation
55
+ if ( $ ( '#nav-menu-container' ) . length ) {
56
+ var $mobile_nav = $ ( '#nav-menu-container' ) . clone ( ) . prop ( {
57
+ id : 'mobile-nav'
58
+ } ) ;
59
+ $mobile_nav . find ( '> ul' ) . attr ( {
60
+ 'class' : '' ,
61
+ 'id' : ''
62
+ } ) ;
63
+ $ ( 'body' ) . append ( $mobile_nav ) ;
64
+ $ ( 'body' ) . prepend ( '<button type="button" id="mobile-nav-toggle"><i class="lnr lnr-menu"></i></button>' ) ;
65
+ $ ( 'body' ) . append ( '<div id="mobile-body-overly"></div>' ) ;
66
+ $ ( '#mobile-nav' ) . find ( '.menu-has-children' ) . prepend ( '<i class="lnr lnr-chevron-down"></i>' ) ;
67
+
68
+ $ ( document ) . on ( 'click' , '.menu-has-children i' , function ( e ) {
69
+ $ ( this ) . next ( ) . toggleClass ( 'menu-item-active' ) ;
70
+ $ ( this ) . nextAll ( 'ul' ) . eq ( 0 ) . slideToggle ( ) ;
71
+ $ ( this ) . toggleClass ( "lnr-chevron-up lnr-chevron-down" ) ;
72
+ } ) ;
73
+
74
+ $ ( document ) . on ( 'click' , '#mobile-nav-toggle' , function ( e ) {
75
+ $ ( 'body' ) . toggleClass ( 'mobile-nav-active' ) ;
76
+ $ ( '#mobile-nav-toggle i' ) . toggleClass ( 'lnr-cross lnr-menu' ) ;
77
+ $ ( '#mobile-body-overly' ) . toggle ( ) ;
78
+ } ) ;
79
+
80
+ $ ( document ) . click ( function ( e ) {
81
+ var container = $ ( "#mobile-nav, #mobile-nav-toggle" ) ;
82
+ if ( ! container . is ( e . target ) && container . has ( e . target ) . length === 0 ) {
83
+ if ( $ ( 'body' ) . hasClass ( 'mobile-nav-active' ) ) {
84
+ $ ( 'body' ) . removeClass ( 'mobile-nav-active' ) ;
85
+ $ ( '#mobile-nav-toggle i' ) . toggleClass ( 'lnr-cross lnr-menu' ) ;
86
+ $ ( '#mobile-body-overly' ) . fadeOut ( ) ;
87
+ }
88
+ }
89
+ } ) ;
90
+ } else if ( $ ( "#mobile-nav, #mobile-nav-toggle" ) . length ) {
91
+ $ ( "#mobile-nav, #mobile-nav-toggle" ) . hide ( ) ;
92
+ }
93
+
94
+ // Smooth scroll for the menu and links with .scrollto classes
95
+ $ ( '.nav-menu a, #mobile-nav a, .scrollto' ) . on ( 'click' , function ( ) {
96
+ if ( location . pathname . replace ( / ^ \/ / , '' ) == this . pathname . replace ( / ^ \/ / , '' ) && location . hostname == this . hostname ) {
97
+ var target = $ ( this . hash ) ;
98
+ if ( target . length ) {
99
+ var top_space = 0 ;
100
+
101
+ if ( $ ( '#header' ) . length ) {
102
+ top_space = $ ( '#header' ) . outerHeight ( ) ;
103
+
104
+ if ( ! $ ( '#header' ) . hasClass ( 'header-fixed' ) ) {
105
+ top_space = top_space ;
106
+ }
107
+ }
108
+
109
+ $ ( 'html, body' ) . animate ( {
110
+ scrollTop : target . offset ( ) . top - top_space
111
+ } , 1500 , 'easeInOutExpo' ) ;
112
+
113
+ if ( $ ( this ) . parents ( '.nav-menu' ) . length ) {
114
+ $ ( '.nav-menu .menu-active' ) . removeClass ( 'menu-active' ) ;
115
+ $ ( this ) . closest ( 'li' ) . addClass ( 'menu-active' ) ;
116
+ }
117
+
118
+ if ( $ ( 'body' ) . hasClass ( 'mobile-nav-active' ) ) {
119
+ $ ( 'body' ) . removeClass ( 'mobile-nav-active' ) ;
120
+ $ ( '#mobile-nav-toggle i' ) . toggleClass ( 'lnr-times lnr-bars' ) ;
121
+ $ ( '#mobile-body-overly' ) . fadeOut ( ) ;
122
+ }
123
+ return false ;
124
+ }
125
+ }
126
+ } ) ;
0 commit comments