11( function ( $ ) {
2-
2+
33 "use strict" ;
4-
5-
4+
5+
66 //Hide Loading Box (Preloader)
77 function handlePreloader ( ) {
88 if ( $ ( '.preloader' ) . length ) {
99 $ ( '.preloader' ) . delay ( 200 ) . fadeOut ( 500 ) ;
1010 }
1111 }
12-
13-
12+
13+
1414 //Update Header Style and Scroll to Top
1515 function headerStyle ( ) {
1616 if ( $ ( '.main-header' ) . length ) {
2626 }
2727 }
2828 }
29-
29+
3030 headerStyle ( ) ;
31-
32-
31+
32+
3333 //Submenu Dropdown Toggle
3434 if ( $ ( '.main-header li.dropdown ul' ) . length ) {
3535 $ ( '.main-header li.dropdown' ) . append ( '<div class="dropdown-btn"><span class="fa fa-angle-down"></span></div>' ) ;
36-
36+
3737 //Dropdown Button
3838 $ ( '.main-header li.dropdown .dropdown-btn' ) . on ( 'click' , function ( ) {
3939 $ ( this ) . prev ( 'ul' ) . slideToggle ( 500 ) ;
4343 $ ( '.main-header .main-menu li.dropdown .dropdown-btn' ) . on ( 'click' , function ( ) {
4444 $ ( this ) . prev ( '.mega-menu' ) . slideToggle ( 500 ) ;
4545 } ) ;
46-
46+
4747 //Disable dropdown parent link
4848 $ ( '.main-header .navigation li.dropdown > a,.hidden-bar .side-menu li.dropdown > a' ) . on ( 'click' , function ( e ) {
4949 e . preventDefault ( ) ;
101101 items :1
102102 } ,
103103 }
104- } ) ;
104+ } ) ;
105105 }
106106
107107 //Events Carousel
129129 items :1
130130 } ,
131131 }
132- } ) ;
132+ } ) ;
133133 }
134134
135135
156156 items :1
157157 }
158158 }
159- } ) ;
159+ } ) ;
160160 }
161161
162162 //About Carousel
183183 items :1
184184 }
185185 }
186- } ) ;
186+ } ) ;
187187 }
188188
189189 //Fact Counter + Text Count
190190 if ( $ ( '.count-box' ) . length ) {
191191 $ ( '.count-box' ) . appear ( function ( ) {
192-
192+
193193 var $t = $ ( this ) ,
194194 n = $t . find ( ".count-text" ) . attr ( "data-stop" ) ,
195195 r = parseInt ( $t . find ( ".count-text" ) . attr ( "data-speed" ) , 10 ) ;
196-
196+
197197 if ( ! $t . hasClass ( "counted" ) ) {
198198 $t . addClass ( "counted" ) ;
199199 $ ( {
211211 }
212212 } ) ;
213213 }
214-
214+
215215 } , { accY : 0 } ) ;
216216 }
217-
218-
217+
218+
219219 //Tabs Box
220220 if ( $ ( '.tabs-box' ) . length ) {
221221 $ ( '.tabs-box .tab-buttons .tab-btn' ) . on ( 'click' , function ( e ) {
222222 e . preventDefault ( ) ;
223223 var target = $ ( $ ( this ) . attr ( 'data-tab' ) ) ;
224-
224+
225225 if ( $ ( target ) . is ( ':visible' ) ) {
226226 return false ;
227227 } else {
238238 //Accordion Box
239239 if ( $ ( '.accordion-box' ) . length ) {
240240 $ ( ".accordion-box" ) . on ( 'click' , '.acc-btn' , function ( ) {
241-
241+
242242 var outerBox = $ ( this ) . parents ( '.accordion-box' ) ;
243243 var target = $ ( this ) . parents ( '.accordion' ) ;
244-
244+
245245 if ( $ ( this ) . hasClass ( 'active' ) !== true ) {
246246 $ ( outerBox ) . find ( '.accordion .acc-btn' ) . removeClass ( 'active ' ) ;
247247 }
248-
248+
249249 if ( $ ( this ) . next ( '.acc-content' ) . is ( ':visible' ) ) {
250250 return false ;
251251 } else {
252252 $ ( this ) . addClass ( 'active' ) ;
253253 $ ( outerBox ) . children ( '.accordion' ) . removeClass ( 'active-block animated fadeInUp' ) ;
254254 $ ( outerBox ) . find ( '.accordion' ) . children ( '.acc-content' ) . slideUp ( 300 ) ;
255255 target . addClass ( 'active-block animated fadeInUp' ) ;
256- $ ( this ) . next ( '.acc-content' ) . slideDown ( 300 ) ;
256+ $ ( this ) . next ( '.acc-content' ) . slideDown ( 300 ) ;
257257 }
258- } ) ;
258+ } ) ;
259259 }
260260
261261 //Custom Seclect Box
262262 if ( $ ( '.custom-select-box' ) . length ) {
263263 $ ( '.custom-select-box' ) . selectmenu ( ) . selectmenu ( 'menuWidget' ) . addClass ( 'overflow' ) ;
264264 }
265-
265+
266266
267267 if ( $ ( '.timer' ) . length ) {
268268 $ ( function ( ) {
296296 mainClass : 'mfp-fade' ,
297297 } ) ;
298298 }
299-
299+
300300 //LightBox / Fancybox
301301 if ( $ ( '.lightbox-image' ) . length ) {
302302 $ ( '.lightbox-image' ) . fancybox ( {
319319 $ ( "input.property-amount" ) . val ( ui . values [ 0 ] + " - " + ui . values [ 1 ] ) ;
320320 }
321321 } ) ;
322-
323- $ ( "input.property-amount" ) . val ( $ ( ".price-range-slider" ) . slider ( "values" , 0 ) + " - $" + $ ( ".price-range-slider" ) . slider ( "values" , 1 ) ) ;
322+
323+ $ ( "input.property-amount" ) . val ( $ ( ".price-range-slider" ) . slider ( "values" , 0 ) + " - $" + $ ( ".price-range-slider" ) . slider ( "values" , 1 ) ) ;
324324 }
325-
326-
325+
326+
327327 //Contact Form Validation
328328 if ( $ ( '#contact-form' ) . length ) {
329329 $ ( '#contact-form' ) . validate ( {
341341 }
342342 } ) ;
343343 }
344-
345-
344+
345+
346346 // Scroll to a Specific Div
347347 if ( $ ( '.scroll-to-target' ) . length ) {
348348 $ ( ".scroll-to-target" ) . on ( 'click' , function ( ) {
351351 $ ( 'html, body' ) . animate ( {
352352 scrollTop : $ ( target ) . offset ( ) . top
353353 } , 1500 ) ;
354-
354+
355355 } ) ;
356356 }
357-
358-
357+
358+ // Contact Form
359+ $ ( '#contact-form' ) . on ( 'submit' , function ( e ) {
360+ e . preventDefault ( ) ;
361+
362+ const formElements = e . target . elements ;
363+ const name = formElements . name . value ;
364+ const email = formElements . email . value ;
365+ const message = formElements . message . value ;
366+
367+ const linebreak = '%0D%0A' ;
368+
369+ window . location . href = `mailto:unstack@gmail.com?subject=Contact Us&body=Hi, Unstack!${ linebreak } ${ linebreak } Action required from @${ email } .${ linebreak } ${ linebreak } ${ message } ${ linebreak } ${ linebreak } Best regards,${ linebreak } ${ name } `
370+ } ) ;
371+
372+
359373 // Elements Animation
360374 if ( $ ( '.wow' ) . length ) {
361375 var wow = new WOW (
374388/* ==========================================================================
375389 When document is Scrollig, do
376390 ========================================================================== */
377-
391+
378392 $ ( window ) . on ( 'scroll' , function ( ) {
379393 headerStyle ( ) ;
380394 } ) ;
381-
395+
382396/* ==========================================================================
383397 When document is loading, do
384398 ========================================================================== */
385-
399+
386400 $ ( window ) . on ( 'load' , function ( ) {
387401 handlePreloader ( ) ;
388- } ) ;
402+ } ) ;
389403
390404} ) ( window . jQuery ) ;
0 commit comments