1( function( $ ) { 2 3 4 /****** Change variables value as per your need ******/ 5 var menuBreakPoint = 991; 6 var sliderBreakPoint= 991; // It will effect when you have used attribute "data-thumb-slider-md-direction" OR "data-slider-md-direction" 7 var mobileAnimation = false; 8 9 /****** Don't change variables value ******/ 10 var lastScroll = 0, 11 simpleDropdown = 0, 12 linkDropdown = 0, 13 isotopeObjs = [], 14 swiperObjs = [], 15 wow = ''; 16 17 /****** Check for browser OS ******/ 18 var isMobile = false, 19 isiPhoneiPad= false, 20 isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); 21 22 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 23 isMobile = true; 24 } 25 26 if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) { 27 isiPhoneiPad = true; 28 } 29 30 /****** jQuery Appear ******/ 31 $( '.image-back-offset-shadow, .vertical-counter, .counter, .progress-bar, .pie-chart-style-01, .pie-chart-style-02' ).each( function() { 32 $( this ).appear().trigger( 'resize' ); 33 }); 34 35 megaMenuOnResize(); 36 animateCounters(); 37 fullScreenHeight(); 38 SetResizeContent(); 39 setOverLayerPosition(); 40 setBottomOverLayerPosition( 2000 ); 41 initScrollNavigate(); 42 stickyFooter(); 43 44 /****** Swiper slider using params ******/ 45 setupSwiper(); 46 destroySwiperLoop() 47 48 /****** Fit videos ******/ 49 $( '.fit-videos' ).fitVids(); 50 51 /* hamberger menu custom scrollbar */ 52 $( '[data-scroll-options]' ).each( function() { 53 var _this = $( this ); 54 var scrollOptions = _this.attr( 'data-scroll-options' ) || '{ "theme": "dark" }'; 55 if ( typeof ( scrollOptions ) !== 'undefined' && scrollOptions !== null ) { 56 scrollOptions = $.parseJSON( scrollOptions ); 57 _this.mCustomScrollbar( scrollOptions ); 58 } 59 }); 60 61 /****** Video player in background ******/ 62 $( document ).on( 'click', '.html-video-play', function () { 63 var $videoBg = $( this ).parents( 'section' ).find( '.video-bg' ); 64 if ( $( this ).is( '[playing]' ) === false ) { 65 $videoBg.trigger( 'play' ); 66 $( this ).attr( 'playing', 'true' ); 67 } else { 68 $videoBg.trigger( 'pause' ); 69 $( this ).removeAttr( 'playing' ); 70 } 71 }); 72 73 /****** Range slider for price filter ******/ 74 if ( $( '.price-filter' ).length > 0 ) { 75 $( '.price-filter' ).slider({ 76 range: true, 77 animate: true, 78 min: 0, 79 max: 4000, 80 step: 1, 81 values: [1, 3999], 82 slide: function ( event, ui ) { 83 $( '.price-amount' ).val( '$' + ui.values[ 0 ] + ' - $' + ui.values[ 1 ] ); 84 $( document.body ).trigger( 'price_slider_change', [ ui.values[0], ui.values[1] ] ); 85 } 86 }); 87 $( '.price-amount' ).val( '$' + $( '.price-filter' ).slider( 'values', 0 ) + 88 ' - $' + $( '.price-filter' ).slider( 'values', 1 ) ); 89 } 90 91 /****** Back Image shadow on jQuery appear ******/ 92 if ( $( '.image-back-offset-shadow' ).length > 0 ) { 93 $( document ).on( 'appear', '.image-back-offset-shadow', function (e) { 94 $( '.image-back-offset-shadow' ).addClass( 'active' ); 95 }); 96 } 97 98 /****** Vertical counter ******/ 99 $( '.vertical-counter' ).each( function () { 100 var _this = $( this ), 101 counterValue = _this.attr( 'data-to' ), 102 individualValue = counterValue.toString().split( '' ), 103 valueLength = counterValue.length; 104 //adding the div.vertical-counter-number in div.counter multiple(valueLength) times 105 for ( var i = 0; i < valueLength; i++ ) { 106 _this.append( '<span class="vertical-counter-number"><ul><li>0</li><li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li><li>7</li><li>8</li><li>9</li></ul></span>' ); 107 } 108 //adding the individual data-to in each div.vertical-counter-number 109 _this.find( '.vertical-counter-number' ).each( function ( index ) { 110 $( this ).attr( 'data-to', individualValue[ index ] ); 111 }); 112 }); 113 114 /****** Vertical counter on jQuery appear ******/ 115 if ( $( '.vertical-counter' ).length > 0 ) { 116 $( document ).on( 'appear', '.vertical-counter', function (e) { 117 if ( $( window ).scrollTop() + getWindowHeight() >= $( '.vertical-counter' ).offset().top ) { 118 $( this ).find( '.vertical-counter-number' ).each( function () { 119 var _this = $( this ), 120 value = _this.attr( 'data-to' ), 121 divHeight = _this.find( 'li' ).height(); 122 _this.height( divHeight ); 123 if ( value <= 9 ) { 124 _this.find( 'ul' ).css({ 'transform': 'translateY(-' + value * 10 + '%)' }); 125 } 126 }); 127 } 128 }); 129 } 130 131 /****** Counter number reset on jQuery appear ******/ 132 if ( $( '.counter' ).length > 0 ) { 133 $( document ).on( 'appear', '.counter', function (e) { 134 var _this = $( this );
135 if ( ! _this.hasClass( 'appear' ) ) { 136 var options = _this.data( 'countToOptions' ) || {}; 137 _this.countTo( options ); 138 _this.addClass( 'appear' ); 139 } 140 }); 141 } 142 143 /****** progress bar on jQuery appear ******/ 144 if ( $( '.progress-bar' ).length > 0 ) { 145 $( document ).on( 'appear', '.progress-bar', function (e) { 146 if ( ! $( this ).hasClass( 'appear' ) ) { 147 $( this ).addClass( 'appear' ); 148 var total = $( this ).attr( 'aria-valuenow' ), 149 delay = 300; 150 $( this ).animate({ 'width': total + '%' }, { 151 duration: delay, 152 easing: "swing", 153 progress: function( animation, progress, msRemaining ) { 154 var counter = parseInt( total * progress ); 155 $( this ).find( 'span' ).html( counter + '%' ); 156 } 157 }); 158 } 159 }); 160 } 161 162 /****** Pie charts style 01 on jQuery appear ******/ 163 if ( $( '.pie-chart-style-01' ).length > 0 ) { 164 var color1, color2; 165 $( document.body ).on( 'appear', '.pie-chart-style-01', function (e) { 166 $( '.pie-chart-style-01' ).easyPieChart({ 167 trackColor: '#232323', 168 scaleColor: "", 169 lineCap: 'round', 170 lineWidth: 10, 171 size: 180, 172 barColor: function () { 173 color1 = $( this.el ).attr( 'data-start-color' ) || $( this.el ).attr( 'data-bar-color' ) || "#000"; 174 color2 = $( this.el ).attr( 'data-end-color' ) || $( this.el ).attr( 'data-bar-color' ) || "#000"; 175 var ctx = this.renderer.getCtx(); 176 var canvas = this.renderer.getCanvas(); 177 var gradient = ctx.createLinearGradient( 0, 0, canvas.width, 270 ); 178 gradient.addColorStop( 0.2, color1 ); 179 gradient.addColorStop( 0, color2 ); 180 return gradient; 181 }, 182 animate: { 183 duration: 2000, 184 enabled: true 185 }, 186 onStep: function (from, to, percent) { 187 $( this.el ).find( '.percent' ).text( Math.round( percent ) + '%' ); 188 } 189 }); 190 }); 191 } 192 193 /****** Pie charts style 02 on jQuery appear ******/ 194 if ( $( '.pie-chart-style-02' ).length > 0 ) { 195 var color1, color2; 196 $( document.body ).on( 'appear', '.pie-chart-style-02', function (e) { 197 $( '.pie-chart-style-02' ).easyPieChart({ 198 trackColor: '#232323', 199 scaleColor: "", 200 lineCap: 'round', 201 lineWidth: 10, 202 size: 140, 203 barColor: function () { 204 color1 = $( this.el ).attr( 'data-start-color' ) || $( this.el ).attr( 'data-bar-color' ) || "#000"; 205 color2 = $( this.el ).attr( 'data-end-color' ) || $( this.el ).attr( 'data-bar-color' ) || "#000"; 206 var ctx = this.renderer.getCtx(); 207 var canvas = this.renderer.getCanvas(); 208 var gradient = ctx.createLinearGradient( 0, 0, canvas.width, 270 ); 209 gradient.addColorStop( 0.2, color1 ); 210 gradient.addColorStop( 0, color2 ); 211 return gradient; 212 }, 213 animate: { 214 duration: 2000, 215 enabled: true 216 }, 217 onStep: function (from, to, percent) { 218 $( this.el ).find( '.percent' ).text( Math.round( percent ) + "%" ); 219 } 220 }); 221 }); 222 } 223 224 /****** Plus quntity in single product page ******/ 225 $( document ).on( 'click', '.qty-plus', function(e) { 226 // Stop acting like a button 227 e.preventDefault(); 228 // Get the field name 229 var fieldName = $( this ).attr( 'data-field' ); 230 // Get its current value 231 var currentVal = parseInt( $( this ).closest( '.quantity' ).find( 'input[name=' + fieldName + ']' ).val() ); 232 // If is not undefined 233 if( ! isNaN( currentVal ) ) { 234 // Increment 235 $( this ).closest( '.quantity' ).find( 'input[name= ' + fieldName + ']' ).val( currentVal + 1 ); 236 } else { 237 // Otherwise put a 0 there 238 $( this ).closest( '.quantity' ).find( 'input[name=' + fieldName + ']' ).val( 0 ); 239 } 240 // Trigger change value 241 $( this ).closest( '.quantity' ).find( '.input-text' ).trigger( 'change' ); 242 }); 243 244 /****** Minus quntity in single product page ******/ 245 $( document ).on( 'click', '.qty-minus', function(e) { 246 // Stop acting like a button 247 e.preventDefault(); 248 // Get the field name 249 var fieldName = $( this ).attr( 'data-field' ); 250 // Get its current value 251 var currentVal = parseInt( $( this ).closest( '.quantity' ).find( 'input[name= ' + fieldName + ']' ).val() ); 252 // If it isn't undefined or its greater than 0 253 if( ! isNaN( currentVal ) && currentVal > 0 ) { 254 // Decrement one 255 $( this ).closest( '.quantity' ).find( 'input[name=' + fieldName + ']' ).val( currentVal - 1 ); 256 } else { 257 // Otherwise put a 0 there 258 $( this ).closest( '.quantity' ).find( 'input[name=' + fieldName + ']' ).val( 0 ); 259 } 260 // Trigger change value 261 $( this ).closest( '.quantity' ).find( '.input-text' ).trigger( 'change' ); 262 }); 263
264 /****** Initialise tooltip *****/ 265 if( $( '[data-bs-toggle="tooltip"]' ).length > 0 ) { 266 $( '[data-bs-toggle="tooltip"]' ).tooltip(); 267 } 268 269 /****** Tilt effect using params ******/ 270 if ( $( '.tilt-box' ).length > 0 && ! isMobile ) { 271 $( '.tilt-box' ).each( function () { 272 var _this = $( this ), 273 tiltOptions = _this.attr( 'data-tilt-options' ) || '{ "maxTilt": 20, "perspective": 1000, "easing": "cubic-bezier(.03,.98,.52,.99)", "scale": 1, "speed": 500, "transition": true, "reset": true, "glare": false, "maxGlare": 1 }'; 274 if ( typeof ( tiltOptions ) !== 'undefined' && tiltOptions !== null ) { 275 tiltOptions = $.parseJSON( tiltOptions ); 276 _this.tilt( tiltOptions ); 277 } 278 }); 279 } 280 281 /****** Justified Gallery ******/ 282 if ( $( '.justified-gallery' ).length > 0 ) { 283 $( '.justified-gallery' ).each( function () { 284 var _this = $( this ), 285 justifiedOptions= _this.attr( 'data-justified-options' ) || '{ "rowHeight": 500, "maxRowHeight": false, "captions": true, "margins": 15, "waitThumbnailsLoad": true }'; 286 if ( typeof ( justifiedOptions ) !== 'undefined' && justifiedOptions !== null ) { 287 _this.imagesLoaded( function () { 288 justifiedOptions = $.parseJSON( justifiedOptions ); 289 _this.justifiedGallery( justifiedOptions ); 290 }); 291 } 292 }); 293 } 294 295 /****** Justified Gallery Tooltip at cursor position ******/ 296 if( ! isMobile ) { 297 $( document ).on( 'mousemove', '.jg-entry', function (e) { 298 var imageWidth = $( this ).width(); 299 var captionWidth = $( this ).find( '.jg-caption' ).width(); 300 var value = $( this ).find( '.caption' ).html(); 301 var parentOffset = $( this ).offset(); 302 var relX = e.pageX - parentOffset.left + 20; 303 var relY = e.pageY - parentOffset.top; 304 if ( relX + captionWidth + 30 > imageWidth ) { 305 relX = relX - captionWidth - 65; 306 } 307 $( this ).css( 'overflow', 'visible' ); 308 $( this ).find( '.jg-caption' ).html( value ).show().css({ left: relX + 'px', right: 'auto', top: relY + 'px', bottom: 'auto' }); 309 }); 310 $( document ).on( 'mouseleave', '.jg-entry', function (e) { 311 $( this ).css( 'overflow', ' ' ); 312 $( this ).find( '.jg-caption' ).hide().css({ left: ' ', right: ' ', top: ' ', bottom: ' ' }); 313 }); 314 } 315 316 /****** Accordion using active/inactive icon params ******/ 317 $( '.accordion-event' ).each( function() { 318 var _this = $( this ), 319 activeIconClass = _this.attr( 'data-active-icon' ) || '', 320 inactiveIconClass = _this.attr( 'data-inactive-icon' ) || ''; 321 $( '.collapse', this ).on( 'show.bs.collapse', function () { 322 var id = $( this ).attr( 'id' ); 323 $( 'a[href="#' + id + '"]' ).closest( '.panel-heading' ).addClass( 'active-accordion' ); 324 $( 'a[href="#' + id + '"] .panel-title i' ).addClass( activeIconClass ).removeClass( inactiveIconClass ); 325 }).on( 'hide.bs.collapse', function () { 326 var id = $( this ).attr( 'id' ); 327 $( 'a[href="#' + id + '"]' ).closest( '.panel-heading' ).removeClass( 'active-accordion' ); 328 $( 'a[href="#' + id + '"] .panel-title i' ).addClass( inactiveIconClass ).removeClass( activeIconClass ); 329 }); 330 }); 331 332 /****** Accordion on checkout ******/ 333 $( '.checkout-accordion label input' ).on( 'click', function (e) { 334 var collapseId = $( this ).parent().find( 'a' ).attr( 'href' ); 335 if( $( this ).prop( "checked" ) ) { 336 $( collapseId ).collapse( 'show' ); 337 } else { 338 $( collapseId ).collapse( 'hide' ); 339 } 340 }); 341 342 /****** Change on Bootstrap tab ******/ 343 $( 'a[data-bs-toggle="tab"]' ).on( 'shown.bs.tab', function (e) { 344 // Hide Accordion on tab change event 345 $( '.tab-content .accordion-event' ).each( function() { 346 $( '.collapse', this ).collapse( 'hide' ); 347 }); 348 // Reset isotope on tab change event 349 resetIsotopeLayoutLoop( isotopeObjs, true ); 350 }); 351 352 /****** Countdown timer ******/ 353 $( '.countdown' ).each( function() { 354 var _this = $( this ); 355 _this.countdown( _this.attr( "data-enddate" ) ).on( 'update.countdown', function ( event ) { 356 _this.html( event.strftime( '' + '<div class="countdown-container"><div class="countdown-box first"><div class="number">%-D</div><span>Day%!d</span></div>' + '<div class="countdown-box"><div class="number">%H</div><span>Hours</span></div>' + '<div class="countdown-box"><div class="number">%M</div><span>Minutes</span></div>' + '<div class="countdown-box last"><div class="number">%S</div><span>Seconds</span></div></div>' ) ); 357 }); 358 }); 359 360 /****** Wow animation ******/ 361 if( $( '.wow' ).length > 0 ) { 362 wow = new WOW({ 363 boxClass: 'wow', 364 animateClass: 'animate__animated', 365 offset: 30, 366 mobile: mobileAnimation, 367 live: true 368 }); 369 $( document ).imagesLoaded( function () { 370 wow.init(); 371 }); 372 } 373 374 /****** Portfolio isotope & filter ******/ 375 $( '.portfolio-wrapper' ).each( function() { 376 var _this = $( this ); 377 if( ! _this.find( '.wow' ).length > 0 ) { 378 _this.find( '.grid-item' ).css( 'visibility', 'hidden' ); 379 } 380 _this.imagesLoaded( function () { 381 if( ! _this.find( '.wow' ).length > 0 ) { 382 _this.find( '.grid-item' ).css( 'visibility', '' ); 383 } else if( ! isMobile ) { 384 _this.find( '.grid-item' ).css( 'visibility', 'hidden' ); 385 } 386 _this.removeClass( 'grid-loading' ); 387 _this.isotope({ 388 layoutMode: 'masonry', 389 itemSelector: '.grid-item', 390 percentPosition: true, 391 stagger: 0, 392 masonry: { 393 columnWidth: '.grid-sizer', 394 } 395 }); 396 isotopeObjs.push( _this ); 397 }); 398 }); 399 $( document ).on( 'click', '.portfolio-filter > li > a', function () { 400 var _this = $( this ), 401 parentSectionObj= _this.parents( 'section' ); 402 parentSectionObj.find( '.portfolio-filter > li' ).removeClass( 'active' ); 403 _this.parent().addClass( 'active' ); 404 var selector = _this.attr( 'data-filter' ), 405 portfolioFilter = parentSectionObj.find( '.portfolio-wrapper' ); 406 // Remove animation 407 removeWowAnimation( portfolioFilter ); 408 // Isotope filter 409 portfolioFilter.isotope({ filter: selector }); 410 return false;
411 }); 412 413 /****** Blog isotope & filter ******/ 414 $( '.blog-wrapper' ).each( function() { 415 var _this = $( this ); 416 if( ! _this.find( '.wow' ).length > 0 ) { 417 _this.find( '.grid-item' ).css( 'visibility', 'hidden' ); 418 } 419 _this.imagesLoaded( function () { 420 if( ! _this.find( '.wow' ).length > 0 ) { 421 _this.find( '.grid-item' ).css( 'visibility', '' ); 422 } else if( ! isMobile ) { 423 _this.find( '.grid-item' ).css( 'visibility', 'hidden' ); 424 } 425 _this.removeClass( 'grid-loading' ); 426 _this.isotope({ 427 layoutMode: 'masonry', 428 itemSelector: '.grid-item', 429 percentPosition: true, 430 stagger: 0, 431 masonry: { 432 columnWidth: '.grid-sizer', 433 } 434 }); 435 isotopeObjs.push( _this ); 436 }); 437 }); 438 $( document ).on( 'click', '.blog-filter > li > a', function () { 439 var _this = $( this ), 440 parentSectionObj= _this.parents( 'section' ); 441 parentSectionObj.find( '.blog-filter > li' ).removeClass( 'active' ); 442 _this.parent().addClass( 'active' ); 443 var selector = _this.attr( 'data-filter' ), 444 blogFilter = parentSectionObj.find( '.blog-wrapper' ); 445 // Remove animation 446 removeWowAnimation( blogFilter ); 447 // Isotope filter 448 blogFilter.isotope({ filter: selector }); 449 return false; 450 }); 451 452 /****** Shop isotope & filter ******/ 453 $( '.shop-wrapper' ).each( function() { 454 var _this = $( this ); 455 if( ! _this.find( '.wow' ).length > 0 ) { 456 _this.find( '.grid-item' ).css( 'visibility', 'hidden' ); 457 } 458 _this.imagesLoaded( function () { 459 if( ! _this.find( '.wow' ).length > 0 ) { 460 _this.find( '.grid-item' ).css( 'visibility', '' ); 461 } else if( ! isMobile ) { 462 _this.find( '.grid-item' ).css( 'visibility', 'hidden' ); 463 } 464 _this.removeClass( 'grid-loading' ); 465 _this.isotope({ 466 layoutMode: 'masonry', 467 itemSelector: '.grid-item', 468 percentPosition: true, 469 stagger: 0, 470 masonry: { 471 columnWidth: '.grid-sizer', 472 } 473 }); 474 isotopeObjs.push( _this ); 475 }); 476 }); 477 $( document ).on( 'click', '.shop-filter > li > a', function () { 478 var _this = $( this ), 479 parentSectionObj= _this.parents( 'section' ); 480 parentSectionObj.find( '.shop-filter > li' ).removeClass( 'active' ); 481 _this.parent().addClass( 'active' ); 482 var selector = _this.attr( 'data-filter' ), 483 shopFilter = parentSectionObj.find( '.shop-wrapper' ); 484 // Remove animation 485 removeWowAnimation( shopFilter ); 486 // Isotope filter 487 shopFilter.isotope({ filter: selector }); 488 return false; 489 }); 490 491 /****** Instagram feed ******/ 492 var instagramWrapperItems = document.querySelectorAll('.instafeed-wrapper'); 493 instagramWrapperItems.forEach( function(instagramWrapperItem, index) { 494 var token = 'IGQVJVSU5yVlZAUQUF4NGdOWVlhNHRhbm5HUUkyWmtTak5sVFZAsMU1Lcm80ZAzR3U3A1dUY5WlZAyLTlFSnlzdWRWNllkUTlkQUdxYTNTNUdxNUpCbUxSZADZAJN0VRakhaOFBPVWhiVnBzdUZAfWFJxVE5sSwZDZD', 495 _this = $( instagramWrapperItem ), 496 token = _this.attr( 'data-token' ) || token, 497 total = _this.attr( 'data-total' ) || '6', // how much photos do you want to get 498 slider= _this.attr( 'data-slider-options' ), 499 _html = _this.html(), 500 outputHTML = ''; 501 if ( typeof ( slider ) !== 'undefined' && slider !== null ) { 502 _this.html( '' ); 503 } 504 $.ajax({ 505 url: 'https://graph.instagram.com/me/media?fields=id,media_type,media_url,timestamp,permalink,comments_count,like_count&access_token='
505+ token, 506 type: 'GET', 507 success: function ( response ) { 508 outputHTML += _this.find( '.grid-item' ).length > 0 ? '<li class="grid-sizer"></li>' : ''; 509 for ( var x in response.data ) { 510 if ( x < parseInt( total ) ) { 511 if ( response.data[x]['media_type'] == 'IMAGE' ) { 512 var link = response.data[x]['permalink'] || '', 513 image = response.data[x]['media_url'] || '', 514 likes = response.data[x]['like_count'] || '', 515 comments= response.data[x]['comments_count'] || '', 516 output = _html; 517 518 output = output.replace( ' href="#"', '' ); 519 output = output.replace( ' src="#"', '' ); 520 output = output.replace( 'data-href', 'href' ); 521 output = output.replace( 'data-src', 'src' ); 522 output = output.replace( '{{link}}', link ); 523 output = output.replace( '{{image}}', image ); 524 output = output.replace( '{{likes}}', likes ); 525 output = output.replace( '{{comments}}', comments ); 526 outputHTML += output; 527 } 528 } 529 } 530 _this.html( outputHTML ); 531 if ( typeof ( slider ) !== 'undefined' && slider !== null ) { 532 // Apply swiper 533 var sliderOptions = $.parseJSON( slider ); 534 var swiperObj = instagramWrapperItem.parentElement; 535 new Swiper( swiperObj, sliderOptions ); 536 } else { 537 // Apply isotope 538 if( ! _this.find( '.wow' ).length > 0 ) { 539 _this.find( '.grid-item' ).css( 'visibility', 'hidden' ); 540 } 541 _this.imagesLoaded(function () { 542 if( ! _this.find( '.wow' ).length > 0 ) { 543 _this.find( '.grid-item' ).css( 'visibility', '' ); 544 } else if( ! isMobile ) { 545 _this.find( '.grid-item' ).css( 'visibility', 'hidden' ); 546 } 547 _this.removeClass( 'grid-loading' ); 548 _this.isotope({ 549 layoutMode: 'masonry', 550 itemSelector: '.grid-item', 551 percentPosition: true, 552 stagger: 0, 553 masonry: { 554 columnWidth: '.grid-sizer', 555 } 556 }); 557 isotopeObjs.push( _this ); 558 }); 559 } 560 }, 561 error: function (data) { 562 var output = '<div class="col-12"><span class=text-center>No Images Found</span></div>'; 563 _this.append( output ); 564 } 565 }); 566 }); 567 568 /****** Interactive portfolio ******/ 569 if ( $( '.fullscreen-hover-list .hover-list-item' ).length > 0 ) { 570 var interactiveEventName = isMobile ? 'click' : 'mouseover'; 571 $( document ).on( interactiveEventName, '.fullscreen-hover-list .hover-list-item a', function (e) { 572 if( ! $( this ).parent().hasClass( 'active' ) ) { 573 $( '.fullscreen-hover-list .hover-list-item' ).removeClass( 'active' ); 574 $( this ).parent().addClass( 'active' ); 575 return false; 576 } 577 }); 578 } 579 580 /****** Colorful portfolio ******/ 581 if ( $( '.portfolio-colorful' ).length > 0 ) { 582 var gridItemCount = $( '.portfolio-colorful' ).find( '.grid-item' ).length, 583 colorList = $( '.portfolio-colorful' ).attr( 'data-backgroundcolor' ) || '#2e94eb', 584 colorOpacity = $( '.portfolio-colorful' ).attr( 'data-opacity' ) || 1, 585 colorArray = colorList.split( ',' ), 586 colorCount = colorArray.length; 587 for ( var gridCount = 0; gridCount < gridItemCount; gridCount++ ) { 588 var color = colorArray[gridCount]; 589 var rgbaCol = 'rgba(' + parseInt( color.slice(-6, -4), 16 ) + ',' + parseInt( color.slice(-4, -2), 16 ) + ',' + parseInt( color.slice(-2), 16 ) + ',' + colorOpacity + ')'; 590 $( '.portfolio-colorful' ).find( '.portfolio-hover:eq(' + gridCount + ')' ).css('background-color', rgbaCol ); 591 if ( colorCount < gridItemCount ) { 592 colorArray.push( colorArray[gridCount] ); 593 } 594 } 595 } 596 597 /****** Colorful page title ******/ 598 if ( $( '.page-title-colorful' ).length > 0 ) { 599 var colorList = $( '.page-title-colorful' ).attr('data-backgroundcolor') || '#2e94eb', colorArray = colorList.split( ',' ), colorArray = colorList.split( ',' ), colorCount = colorArray.length, i = 1, colorCode; 600 $( '.page-title-colorful' ).css({ 'background-color': colorArray[0] }); 601 setInterval( function () { 602 colorCode = colorArray[i]; 603 $( '.page-title-colorful' ).css({ 'background-color': colorCode }); 604 i++; 605 if ( i === colorCount ) { 606 i = 0; 607 } 608 }, 5000 ); 609 } 610 611 /******* Search popup open *******/ 612 $( document ).on( 'click', '.search-form-icon', function (e) { 613 e.preventDefault(); 614 if ( $( this ).parents( '.top-bar' ).length > 0 ) { 615 $( 'body' ).addClass( 'show-search-popup-mini-header' ); 616 } 617 $( '.search-form-wrapper' ).addClass( 'active-form' ); 618 $( 'body' ).addClass( 'show-search-popup' ); 619 }); 620 621 /******* Search popup close *******/ 622 $( document ).on( 'click', '.search-close', function (e) { 623 e.preventDefault(); 624 $( '.search-form-wrapper' ).removeClass( 'active-form' ); 625 if ( $( this ).parents( '.top-bar' ).length > 0 ) { 626 $( 'body' ).removeClass( 'show-search-popup-mini-header' ); 627 } 628 $( 'body' ).removeClass( 'show-search-popup' ); 629 }); 630 631 /****** Search validation ******/ 632 $( document ).on( 'click', '.search-button', function() { 633 var error = true; 634 var formObj = $( this ).parents( 'form' ); 635 formObj.find( 'input[type=text]' ).each( function ( index ) { 636 var _this = $( this ), 637 searchVal = _this.val(); 638 if ( searchVal === null || searchVal === '' ) { 639 formObj.find( 'input:eq(' + index + ')' ).addClass( 'search-error' ); 640 error = false;
641 } else { 642 formObj.find( 'input:eq(' + index + ')' ).removeClass( 'search-error' ); 643 } 644 }); 645 return error; 646 }); 647 648 /******* Hamburger menu open *******/ 649 $( document ).on( 'click', '.header-push-button .push-button', function () { 650 $( 'body' ).toggleClass( 'show-menu' ); 651 $( 'body' ).toggleClass( 'hamburger-show-menu' ); 652 }); 653 654 /******* Hamburger / Side menu close *******/ 655 $( document ).on( 'click', '.close-menu', function () { 656 if ( ! flag ) { 657 flag = true; 658 setTimeout( function () { 659 flag = false; 660 }, 500 ); 661 $( 'body' ).removeClass( 'show-menu' ).removeClass( 'left-classic-mobile-menu' ); 662 $( '.sub-menu-item').collapse( 'hide' ); 663 $( '.menu-list-item.open' ).removeClass( 'show' ); 664 } 665 }); 666 667 /******* Side menu close on outside area *******/ 668 $( document ).on( 'touchstart click', '.show-menu', function (e) { 669 if( ! ( $( e.target ).hasClass( 'push-button' ) || $( e.target ).closest( '.push-button' ).length || $( e.target ).closest( '.push-menu' ).length || $( e.target ).closest( '.hamburger-menu' ).length ) ) { 670 $( '.close-menu' ).trigger( 'click' ); 671 } 672 }); 673 674 /******* Side menu open *******/ 675 $( document ).on( 'click', '.side-menu-button', function () { 676 $( 'body' ).toggleClass( 'show-menu' ); 677 // For Left Classic menu in Mobile 678 if ( ( $( '.left-sidebar-wrapper' ).length > 0 ) && getWindowWidth() <= menuBreakPoint ) { 679 $( 'body' ).toggleClass( 'left-classic-mobile-menu' ); 680 } 681 $( '.sub-menu-item').collapse( 'hide' ); 682 $( '.menu-list-item.open' ).removeClass( 'show' ); 683 }); 684 685 /******* Close on escape key *******/ 686 $( document ).on( 'keydown', function (e) { 687 if ( e.keyCode === 27 ) { 688 689 // Close side menu 690 $( '.close-menu' ).trigger( 'click' ); 691 692 $( window ).trigger( 'closemenu' ); 693 } 694 }); 695 696 /****** Scroll to top *****/ 697 $( document ).on( 'click', '.scroll-top-arrow', function () { 698 $( 'html, body' ).animate({ scrollTop: 0 }, 800 ); 699 return false; 700 }); 701 702 /****** Smooth scroll ******/ 703 var scrollAnimationTime = 1200, scrollAnimation = 'easeInOutExpo'; 704 $( 'a.scrollto' ).bind( 'click.smoothscroll', function ( event ) { 705 event.preventDefault(); 706 var target = this.hash; 707 if ( $( target ).length !== 0 ) { 708 $( 'html, body' ).stop() 709 .animate({ 710 'scrollTop': $(target).offset().top 711 }, scrollAnimationTime, scrollAnimation, function () { 712 window.location.hash = target; 713 }); 714 } 715 }); 716 717 /****** Inner link ******/ 718 if ( $( '.navbar-reverse-scroll' ).length > 0 ) { 719 $('.inner-link').smoothScroll({ 720 speed: 900, 721 offset: 0, 722 beforeScroll: function() { $( '.navbar-collapse.collapse' ).collapse( 'hide' ); } 723 }); 724 } else { 725 $( '.inner-link' ).smoothScroll({ 726 speed: 900, 727 offset: -59, 728 beforeScroll: function() { $( '.navbar-collapse.collapse' ).collapse( 'hide' ); } 729 }); 730 } 731 732 /****** Section link ******/ 733 $( '.section-link' ).smoothScroll({ 734 speed: 900, 735 offset: 1, 736 beforeScroll: function() { $( '.navbar-collapse.collapse' ).collapse( 'hide' ); } 737 }); 738 739 /****** Subscribe popup on page load ******/ 740 if ( $( '#subscribe-popup' ).length > 0 ) { 741 var delaySecond = 1, 742 expireDays = 30, 743 cookieName = 'litho-promo-popup'; 744 if( getCookie( cookieName ) != 'shown' ) { 745 setTimeout( function () { 746 $.magnificPopup.open({ 747 showCloseBtn: false, 748 items: { 749 src: '#subscribe-popup' 750 }, 751 type: 'inline', 752 mainClass: 'my-mfp-zoom-in', 753 callbacks: { 754 close: function() { 755 if( $( '#newsletter-off' ).is( ':checked' ) ) {
756 setCookie( cookieName, 'shown', expireDays ); 757 } 758 } 759 } 760 }); 761 }, ( delaySecond * 1000 ) ); 762 } 763 } 764 765 /****** Coming soon notify me form popup ******/ 766 $( '.notify-form-button' ).magnificPopup({ 767 mainClass: 'mfp-notify', 768 closeOnBgClick: true, 769 preloader: false, 770 fixedContentPos: false, 771 removalDelay: 100, 772 closeBtnInside: false, 773 callbacks: { 774 open: function () { 775 setTimeout( function () { 776 $( '.notify-input' ).focus(); 777 }, 100 ); 778 $( '#notify_form' ).parent().addClass( 'notify-popup' ); 779 $( '#notify_form' ).parents( 'body' ).addClass( 'show-notify-popup' ); 780 }, 781 close: function () { 782 $('body').removeClass( 'show-notify-popup' ); 783 } 784 } 785 }); 786 787 /****** Lightbox gallery ******/ 788 $( '.lightbox-gallery' ).magnificPopup({ 789 delegate: 'a', 790 type: 'image', 791 tLoading: 'Loading image #%curr%...', 792 mainClass: 'mfp-fade', 793 fixedContentPos: true, 794 closeBtnInside: false, 795 gallery: { 796 enabled: true, 797 navigateByImgClick: true, 798 preload: [0, 1] // Will preload 0 - before current, and 1 after the current image 799 } 800 }); 801 802 /* Group light box gallery image */ 803 var lightboxgallerygroups = {}; 804 $( '.lightbox-group-gallery-item' ).each(function () { 805 var id = $( this ).attr( 'data-group' ); 806 if ( ! lightboxgallerygroups[id] ) { 807 lightboxgallerygroups[id] = []; 808 } 809 lightboxgallerygroups[id].push( this ); 810 }); 811 $.each( lightboxgallerygroups, function () { 812 $( this ).magnificPopup({ 813 type: 'image', 814 closeOnContentClick: true, 815 closeBtnInside: false, 816 fixedContentPos: true, 817 gallery: {enabled: true} 818 }); 819 }); 820 821 /****** Lightbox portfolio gallery ******/ 822 $( '.lightbox-portfolio' ).magnificPopup({ 823 delegate: '.gallery-link', 824 type: 'image', 825 tLoading: 'Loading image #%curr%...', 826 mainClass: 'mfp-fade', 827 fixedContentPos: true, 828 closeBtnInside: false, 829 closeOnContentClick: true, 830 gallery: { 831 enabled: true, 832 navigateByImgClick: false, 833 preload: [0, 1] // Will preload 0 - before current, and 1 after the current image 834 } 835 }); 836 837 /****** Single image lightbox - zoom animation ******/ 838 $( '.single-image-lightbox' ).magnificPopup({ 839 type: 'image', 840 closeOnContentClick: true, 841 fixedContentPos: true, 842 closeBtnInside: false, 843 mainClass: 'mfp-no-margins mfp-with-zoom', // class to remove default margin from left and right side 844 image: { 845 verticalFit: true 846 }, 847 zoom: { 848 enabled: true, 849 duration: 300 // don't foget to change the duration also in CSS 850 } 851 }); 852 853 /****** Zoom gallery ******/ 854 $( '.zoom-gallery' ).magnificPopup({ 855 delegate: 'a', 856 type: 'image', 857 mainClass: 'mfp-with-zoom mfp-img-mobile', 858 fixedContentPos: true, 859 closeBtnInside: false, 860 image: { 861 verticalFit: true, 862 titleSrc: function ( item ) { 863 return item.el.attr( 'title' ); 864 } 865 }, 866 gallery: { 867 enabled: true 868 }, 869 zoom: { 870 enabled: true, 871 duration: 300, // don't foget to change the duration also in CSS 872 opener: function ( element ) { 873 return element.find( 'img' ); 874 } 875 } 876 }); 877 878 /****** Modal popup ******/ 879 $( '.modal-popup' ).magnificPopup({ 880 type: 'inline', 881 preloader: false, 882 // modal: true, 883 blackbg: true 884 }); 885 886 /****** Modal popup close ******/ 887 $( document ).on( 'click', '.popup-modal-dismiss', function (e) { 888 e.preventDefault(); 889 $.magnificPopup.close(); 890 }); 891 892 /****** Modal popup - zoom animation ******/ 893 $( '.popup-with-zoom-anim' ).magnificPopup({ 894 type: 'inline',
895 fixedContentPos: false, 896 fixedBgPos: true, 897 overflowY: 'auto', 898 closeBtnInside: true, 899 preloader: false, 900 midClick: true, 901 removalDelay: 300, 902 blackbg: true, 903 mainClass: 'my-mfp-zoom-in' 904 }); 905 906 /****** Modal popup - move animation ******/ 907 $( '.popup-with-move-anim' ).magnificPopup({ 908 type: 'inline', 909 fixedContentPos: false, 910 fixedBgPos: true, 911 overflowY: 'auto', 912 closeBtnInside: true, 913 preloader: false, 914 midClick: true, 915 removalDelay: 300, 916 blackbg: true, 917 mainClass: 'my-mfp-slide-bottom' 918 }); 919 920 /****** Popup with form ******/ 921 $( '.popup-with-form' ).magnificPopup({ 922 type: 'inline', 923 preloader: false, 924 closeBtnInside: false, 925 fixedContentPos: true, 926 focus: '#name', 927 callbacks: { 928 beforeOpen: function () { 929 if ( getWindowWidth() < 700) { 930 this.st.focus = false; 931 } else { 932 this.st.focus = '#name'; 933 } 934 } 935 } 936 }); 937 938 /****** Video magnific popup ******/ 939 $( '.popup-youtube, .popup-vimeo' ).magnificPopup({ 940 disableOn: 767, 941 type: 'iframe', 942 mainClass: 'mfp-fade', 943 removalDelay: 160, 944 preloader: false, 945 fixedContentPos: true, 946 closeBtnInside: false 947 }); 948 949 /****** Google map magnific popup ******/ 950 $( '.popup-googlemap' ).magnificPopup({ 951 disableOn: 0, 952 type: 'iframe', 953 mainClass: 'mfp-fade', 954 removalDelay: 160, 955 preloader: false, 956 fixedContentPos: true, 957 closeBtnInside: false 958 }); 959 960 /****** Ajax magnific popup ******/ 961 $( '.ajax-popup' ).magnificPopup({ 962 type: 'ajax', 963 alignTop: true, 964 fixedContentPos: true, 965 closeBtnInside: false, 966 overflowY: 'scroll', // as we know that popup content is tall we set scroll overflow by default to avoid jump 967 callbacks: { 968 open: function () { 969 $( '.navbar .collapse' ).removeClass( 'show' ); 970 $( '.navbar a.dropdown-toggle' ).addClass( 'collapsed' ); 971 } 972 } 973 }); 974 975 /****** Contact form validation on submit ******/ 976 $( document ).on( 'click', '.submit', function() { 977 var error = false, 978 captchaFlag = false, 979 _this = $( this ), 980 formObj = _this.parents( 'form' ), 981 emailFormat = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/, 982 telFormat = /[0-9 -()+]+$/, 983 actionURL = formObj.attr( 'action' ), 984 resultsObj = formObj.find( '.form-results' ), 985 grecaptchav3= _this.attr( 'data-sitekey' ) || '', 986 redirectVal = formObj.find( '[name="redirect"]' ).val(); 987 formObj.find( '.required' ).removeClass( 'error' ); 988 formObj.find( '.required' ).each( function() { 989 var __this = $( this ), 990 fieldVal= __this.val(); 991 if( fieldVal == '' || fieldVal == undefined ) { 992 error = true; 993 __this.addClass( 'error' ); 994 } else if( __this.attr( 'type' ) == 'email' && ! emailFormat.test( fieldVal ) ) { 995 error = true; 996 __this.addClass( 'error' ); 997 } else if( __this.attr( 'type' ) == 'tel' && ! telFormat.test( fieldVal ) ) { 998 error = true; 999 __this.addClass( 'error' ); 1000 } 1001 }); 1002 var termsObj = formObj.find( '.terms-condition' ); 1003 if ( termsObj.length > 0 ) { 1004 if ( ! termsObj.is( ':checked' ) ) { 1005 error = true; 1006 termsObj.addClass( 'error' ); 1007 } 1008 } 1009 // Google reCaptcha Verify 1010 if ( typeof ( grecaptcha ) !== 'undefined' && grecaptcha !== null ) { 1011 if( formObj.find( '.g-recaptcha' ).length > 0 ) { // For Version 2 1012 var gResponse = grecaptcha.getResponse(); 1013 if ( ! ( gResponse.length ) ) { 1014 error = true; 1015 formObj.find( '.g-recaptcha' ).addClass( 'error' ); 1016 } 1017 } else if( grecaptchav3 != '' && grecaptchav3 != undefined ) { // For Version 3 1018 captchaFlag = true; 1019 formObj.find( 'input[name=action],input[name=g-recaptcha-response]' ).remove(); 1020 grecaptcha.ready(function() { 1021 grecaptcha.execute( grecaptchav3, { action: 'subscribe_newsletter' } ).then( function( token ) { 1022 formObj.prepend('<input type="hidden" name="g-recaptcha-response" value="' + token + '">'); 1023 formObj.prepend('<input type="hidden" name="action" value="subscribe_newsletter">'); 1024 1025 if( ! error ) { 1026 submitAJAXForm( _this ); 1027 } 1028 }); 1029 }); 1030 } 1031 } 1032 if( ! error && ! captchaFlag ) { // Check no errors && no google reCaptcha V3 1033 submitAJAXForm( _this ); 1034 } 1035 return false;
1036 }); 1037 1038 /****** Contact form validation on blur ******/ 1039 $( document ).on( 'blur', '.required', function() { 1040 var emailFormat = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/, 1041 telFormat = /[0-9 -()+]+$/, 1042 fieldVal = $( this ).val(); 1043 if( fieldVal == '' || fieldVal == undefined ) { 1044 $( this ).addClass( 'error' ); 1045 } else if( $( this ).attr( 'type' ) == 'email' && ! emailFormat.test( fieldVal ) ) { 1046 $( this ).addClass( 'error' ); 1047 } else if( $( this ).attr( 'type' ) == 'tel' && ! telFormat.test( fieldVal ) ) { 1048 $( this ).addClass( 'error' ); 1049 } else { 1050 $( this ).removeClass( 'error' ); 1051 } 1052 }); 1053 1054 /****** Validate terms and conditions in form ******/ 1055 $( document ).on( 'click', '.terms-condition', function() { 1056 var termsObj = $( this ); 1057 if ( ! termsObj.is( ':checked' ) ) { 1058 termsObj.addClass( 'error' ); 1059 } else { 1060 termsObj.removeClass( 'error' ); 1061 } 1062 }); 1063 1064 /****** Active class to current menu for only html ******/ 1065 var pgurl = window.location.href.substr( window.location.href.lastIndexOf( '/' ) + 1 ); 1066 var $hash = window.location.hash.substring( 1 ); 1067 if ( $hash ) { 1068 $hash = '#' + $hash; 1069 pgurl = pgurl.replace( $hash, '' ); 1070 } else { 1071 pgurl = pgurl.replace( '#', '' ); 1072 } 1073 $( '.navbar-nav li a, .menu-list a' ).each( function () { 1074 var _this = $( this ), 1075 aHref = _this.attr( 'href' ); 1076 if ( aHref === pgurl || aHref === pgurl + '.html' ) { 1077 _this.addClass( 'active' ); 1078 _this.parent().addClass( 'active' ); 1079 _this.parents( 'li.dropdown' ).addClass( 'active' ); 1080 _this.parents( 'li.menu-list-item' ).addClass( 'active' ); 1081 } 1082 }); 1083 1084 /****** Mobile menu modern style ******/ 1085 var mobileStyle = $( 'body' ).attr( 'data-mobile-nav-style' ); 1086 if ( ( mobileStyle == 'modern' || mobileStyle == 'full-screen-menu' ) && ! $( '.navbar-' + mobileStyle + '-inner').length ) { 1087 1088 if ( ! $( '.box-layout' ).length > 0 && mobileStyle == 'modern' ) { 1089 $( 'section, footer' ).wrapAll( '<div class="page-layout"></div>' ); 1090 } else { 1091 $( 'section' ).wrapAll( '<div class="page-layout"></div>' ); 1092 } 1093 var targetButtonClone = $( '.navbar .navbar-toggler' ).clone( true ).addClass( 'navbar-toggler-clone' ).insertAfter( '.page-layout' ); 1094 var targetNavClone = $( '.navbar .navbar-collapse' ).clone( true ).addClass( 'navbar-collapse-clone' ).attr( 'id', 'navbarNav-clone' ).insertAfter( '.page-layout' ); 1095 $( '.navbar-toggler-clone, .navbar-collapse-clone' ).wrapAll( '<div class="navbar-' + mobileStyle + '-inner"></div>' ); 1096 $( '.navbar-toggler').attr( 'data-bs-target', '#navbarNav-clone' ).attr( 'aria-controls', '#navbarNav-clone' ); 1097 $( '.navbar-' + mobileStyle + '-inner' ).find( '.dropdown-toggle' ).addClass( 'dropdown-toggle-clone' ); 1098 if ( $( '.navbar-collapse-clone' ).length > 0) { 1099 var scrollOptions = $( '.navbar-collapse-clone' ).attr( 'data-scroll-options' ) || '{ "theme": "light" }'; 1100 if ( typeof ( scrollOptions ) !== 'undefined' && scrollOptions !== null ) { 1101 scrollOptions = $.parseJSON( scrollOptions ); 1102 $( '.navbar-collapse-clone' ).mCustomScrollbar( scrollOptions ); 1103 } 1104 } 1105 if ( mobileStyle == 'modern' ) { 1106 $( '<div class="navbar-show-modern-bg"></div>' ).insertAfter( '.page-layout' ); 1107 } 1108 } 1109 1110 /****** Hide collaps on outside click ******/ 1111 $( document ).on( 'touchstart click', 'body', function (e) { 1112 if ( ! $( e.target ).closest( '.navbar-nav' ).length ) { 1113 if( ! $( e.target ).closest( '.header-language' ).length ) { 1114 // Close language menu 1115 $( '.header-language' ).trigger( 'mouseleave' ); 1116 $( '.header-language' ).removeClass( 'show' ); 1117 $( '.header-language' ).children( '.dropdown-menu' ).removeClass( 'show' ); 1118 } 1119 if( ! $( e.target ).closest( '.header-cart-icon' ).length ) { 1120 // Close cart 1121 $( '.header-cart-icon' ).trigger( 'mouseleave' ); 1122 $( '.header-cart-icon' ).removeClass( 'show' ); 1123 $( '.header-cart-icon' ).children( '.dropdown-menu' ).removeClass( 'show' ); 1124 } 1125 // Close all dropdown 1126 $( '.navbar-nav .dropdown' ).each( function () { 1127 var _this = $( this ); 1128 _this.trigger( 'mouseleave' ); 1129 _this.removeClass( 'show' ); 1130 _this.children( '.dropdown-menu' ).removeClass( 'show' ); 1131 }); 1132 // Close classic menu 1133 $( '[data-mobile-nav-style="classic"] .navbar-collapse' ).collapse( 'hide' ); 1134 // Close theme demos 1135 if( ! $( e.target ).closest( '.theme-demos' ).length && $( '.theme-demos' ).hasClass( 'active' ) ) { 1136 $( '.theme-demos' ).removeClass( 'active' ); 1137 $( 'body' ).removeClass( 'overflow-hidden' ); 1138 } 1139 } else if( $( e.target ).parents( '.show-menu' ).length ) { 1140 // Close side menu 1141 $( '.close-menu' ).trigger( 'click' ); 1142 } else if( $( e.target ).parents( 'body' ).find( '.header-language.open' ).length ) { 1143 // Close language menu 1144 $( '.header-language' ).trigger( 'mouseleave' ); 1145 $( '.header-language' ).removeClass( 'show' ); 1146 $( '.header-language' ).children( '.dropdown-menu' ).removeClass( 'show' ); 1147 } else if( $( e.target ).parents( 'body' ).find( '.header-cart-icon.open' ).length ) { 1148 // Close cart 1149 $( '.header-cart-icon' ).trigger( 'mouseleave' ); 1150 $( '.header-cart-icon' ).removeClass( 'show' ); 1151 $( '.header-cart-icon' ).children( '.dropdown-menu' ).removeClass( 'show' ); 1152 } 1153 if ( ! $( e.target ).parents( 'header' ) && isMobile ) { 1154 $( '.header-language, .header-cart-icon' ).each( function () { 1155 var _this = $( this ); 1156 _this.trigger( 'mouseleave' ); 1157 _this.removeClass( 'show' ); 1158 _this.children( '.dropdown-menu' ).removeClass( 'show' ); 1159 }); 1160 } 1161 if ( $( e.target ).closest( '.search-form-wrapper' ).length === 0 || $( e.target ).is( '.form-wrapper' ) ) { 1162 $( '.search-form-wrapper' ).removeClass( 'active-form' ); 1163 $( 'body' ).removeClass( 'show-search-popup' ); 1164 } 1165 }); 1166 1167 /****** Navbar collapse classic menu event ******/ 1168 $( '[data-mobile-nav-style="classic"] .navbar-collapse.collapse' ).on( 'show.bs.collapse', function () { 1169 if ( ! $( 'body' ).hasClass( 'navbar-collapse-show' ) ) { 1170 $( 'body' ).addClass( 'navbar-collapse-show' ); 1171 } 1172 }).on( 'hide.bs.collapse', function () { 1173 if ( $( 'body' ).hasClass( 'navbar-collapse-show' ) ) { 1174 $( 'body' ).removeClass( 'navbar-collapse-show' ); 1175 } 1176 }); 1177 1178 /****** Navbar collapse modern & full screen event ******/ 1179 $( '.navbar-collapse-clone' ).on( 'show.bs.collapse', function () { 1180 if ( ! $( 'body' ).hasClass( 'navbar-collapse-show' ) ) { 1181 $( 'body' ).addClass( 'navbar-collapse-show' ); 1182 $( 'html' ).addClass( 'overflow-hidden' ); 1183 if ( $( 'body' ).attr( 'data-mobile-nav-bg-color' ) && $( '.navbar-modern-inner' ).length > 0 ) { 1184 var bgColor = $( 'body' ).attr( 'data-mobile-nav-bg-color' );
1185 $( '.navbar-show-modern-bg' ).css( 'background', bgColor ); 1186 } 1187 if ( $( 'body' ).attr( 'data-mobile-nav-bg-color' ) && $( '.navbar-full-screen-menu-inner' ).length > 0 ) { 1188 var bgColor = $( 'body' ).attr( 'data-mobile-nav-bg-color' ); 1189 $( '.navbar-full-screen-menu-inner' ).css( 'background', bgColor ); 1190 } 1191 } else { 1192 if ( $('.navbar-modern-inner' ).length > 0 ) { 1193 setTimeout(function () { 1194 $( '.navbar-show-modern-bg' ).css( 'background', '' ); 1195 }, 600); 1196 } 1197 if ( $( '.navbar-full-screen-menu-inner' ).length > 0 ) { 1198 setTimeout(function () { 1199 $( '.navbar-full-screen-menu-inner' ).css( 'background', '' ); 1200 }, 600); 1201 } 1202 } 1203 var headerHeight = getTopSpaceHeaderHeight(); 1204 var windowHeight = getWindowHeight(); 1205 if ( $( '.navbar-modern-inner' ).length > 0 || $( '.navbar-full-screen-menu-inner' ).length > 0 ) { 1206 $( this ).css( 'max-height', windowHeight ); 1207 } else { 1208 $( this ).css( 'max-height', ( windowHeight - headerHeight ) ); 1209 } 1210 }).on( 'hide.bs.collapse', function () { 1211 if ( $( 'body' ).hasClass( 'navbar-collapse-show' ) ) { 1212 $( 'body' ).removeClass( 'navbar-collapse-show' ); 1213 $( 'html' ).removeClass( 'overflow-hidden' ); 1214 } 1215 }); 1216 1217 /****** Hamburger menu animation with collapse ******/ 1218 $( '.menu-toggle' ).each( function ( index ) { 1219 var _this = $( this ); 1220 _this.addClass( 'collapsed' ).attr({ 'data-bs-toggle': 'collapse', 'data-bs-target': '#sub-menu-' + index }); 1221 _this.parent().find( '.sub-menu-item' ).attr( 'id', 'sub-menu-' + index ).addClass( 'collapse' ); 1222 }); 1223 1224 /****** Sticky left menu ******/ 1225 if ( $( '.left-sidebar-wrapper').length > 0 ) { 1226 $( '.left-sidebar-wrapper .left-sidebar-nav' ).stick_in_parent({ 1227 recalc: 1, 1228 bottoming: false 1229 }); 1230 } 1231 $( document ).on( 'click', '.menu-list > .menu-list-item > .menu-toggle', function () { 1232 $( '.sub-menu-item' ).each( function () { 1233 $( this ).collapse( 'hide' ); 1234 }); 1235 $( '.left-sidebar-wrapper .left-sidebar-nav' ).parents( 'body' ).addClass( 'left-classic-mobile-menu' ); 1236 setTimeout( function () { 1237 $( '.left-sidebar-wrapper' ).trigger( 'sticky_kit:recalc' ); 1238 }, 500 ); 1239 }); 1240 $( document ).on( 'click', '.sub-menu-item > .menu-list-item > .menu-toggle', function (e) { 1241 e.preventDefault(); 1242 var _parent = $( this ).parent().find( '.sub-menu-item' ); 1243 var _parentAttr = $( this ).attr( 'data-bs-target' ); 1244 $( this ).parent().parent( '.sub-menu-item' ).find( '.sub-menu-item' ).each( function () { 1245 var _this = $( this ), 1246 attr = _this.parent().find( '.menu-toggle' ).attr( 'data-bs-target' ); 1247 if ( attr != _parentAttr ) { 1248 _this.collapse( 'hide' ); 1249 } 1250 }); 1251 $( '.left-sidebar-wrapper .left-sidebar-nav' ).parents( 'body' ).addClass( 'left-classic-mobile-menu' ); 1252 setTimeout( function () { 1253 $( '.left-sidebar-wrapper' ).trigger( 'sticky_kit:recalc' ); 1254 }, 500); 1255 }); 1256 1257 /******* Sidebar nav open *******/ 1258 $( document ).on( 'click', '#mobileToggleSidenav', function (e) { 1259 e.preventDefault(); 1260 $( this ).closest( 'nav' ).toggleClass( 'sidemenu-open' ); 1261 }); 1262 1263 /******* Navbar toggle *******/ 1264 var flag = false; 1265 $( document ).on( 'click', '.navbar-toggle', function () { 1266 if ( getWindowWidth() > menuBreakPoint ) { 1267 if ( ! flag ) { 1268 flag = true; 1269 setTimeout( function () { 1270 flag = false; 1271 }, 500 ); 1272 $( 'body' ).addClass( 'show-menu' ); 1273 } else { 1274 if ( ! $( '.navbar-collapse' ).has( e.target ).is( '.navbar-collapse' ) && $( '.navbar-collapse ul' ).hasClass( 'show' ) ) { 1275 $( '.navbar-collapse' ).find( 'a.dropdown-toggle' ).addClass( 'collapsed' ); 1276 $( '.navbar-collapse' ).find( 'ul.dropdown-menu' ).removeClass( 'show' ); 1277 $( '.navbar-collapse a.dropdown-toggle' ).removeClass( 'active' ); 1278 } 1279 } 1280 } 1281 }); 1282 1283 /****** Open menu on hover ******/ 1284 $( '.dropdown' ).on( 'mouseenter touchstart', function( e ) { 1285 1286 var _this = $( this ); 1287 _this.siblings( '.dropdown' ).removeClass( 'open' ); 1288 _this.parents( '.navbar-nav' ).siblings( '.navbar-nav' ).find( '.dropdown' ).removeClass( 'open' ); 1289 _this.addClass( 'open' ); 1290 if ( getWindowWidth() > menuBreakPoint ) { 1291 menuPosition( _this ); 1292 if( $( e.target ).siblings( '.dropdown-menu' ).length ) { 1293 e.preventDefault(); 1294 } 1295 } 1296 1297 }).on( 'mouseleave', function( e ) { 1298 1299 var _this = $( this ); 1300 _this.removeClass( 'menu-left' ); 1301 _this.removeClass( 'open' ); 1302 }); 1303 1304 /****** Non retina image code ******/ 1305 $( "img:not([data-at2x])" ).each( function() { 1306 $( this ).attr( 'data-no-retina', '' ); 1307 }); 1308 1309 /****** Window load ******/ 1310 $( window ).on( 'load', function () { 1311 1312 /****** Parallax ******/ 1313 setParallax(); 1314 1315 /****** Reset isotope loop ******/ 1316 resetIsotopeLayoutLoop( isotopeObjs, false ); 1317 1318 /****** Reset swiper loop ******/ 1319 resetSwiperLoop(); 1320 1321 /****** Sticky footer ******/ 1322 stickyFooter(); 1323 1324 /***** Revolution slider navigation effect *****/ 1325 RevolutionArrowEffect(); 1326 1327 /***** Top overlap section position *****/ 1328 setOverLayerPosition(); 1329 1330 /****** Bottom overlap section position ******/ 1331 setBottomOverLayerPosition(); 1332 }); 1333 1334 /****** Window resize ******/ 1335 $( window ).resize( function () { 1336 1337 fullScreenHeight(); 1338 destroySwiperLoop(); 1339 resetSwiperLoop(); 1340 stickyFooter(); 1341 1342 setTimeout( function () { 1343 resetIsotopeLayoutLoop( isotopeObjs, true ); 1344 }, 300 ); 1345 1346 setTimeout( function () { 1347 SetResizeContent(); 1348 setOverLayerPosition(); 1349 setBottomOverLayerPosition( 100 ); 1350 initScrollNavigate(); 1351 }, 500 ); 1352 1353 }); // End resize event 1354 1355 /****** Window orientationchange ******/ 1356 $( window ).on( 'orientationchange', function(e) { 1357 1358 // Close side menu 1359 $( '.close-menu' ).trigger( 'click' ); 1360 1361 $( window ).trigger( 'closemenu' ); 1362 }); 1363 1364 /****** Closemenu ******/ 1365 $( window ).on( 'closemenu', function(e) { 1366 1367 // Close all dropdown 1368 $( '.dropdown' ).each( function () { 1369 var _this = $( this ); 1370 _this.trigger( 'mouseleave' ); 1371 _this.removeClass( 'show' ); 1372 _this.children( '.dropdown-menu' ).removeClass( 'show' ); 1373 }); 1374 1375 // Close all menu 1376 if ( $( '.navbar-collapse' ).hasClass( 'show') ) { 1377 $( '.navbar-collapse' ).removeClass( 'show' ); 1378 } 1379 if ( $( 'body' ).hasClass( 'navbar-collapse-show') ) { 1380 $( 'body' ).removeClass( 'navbar-collapse-show'); 1381 $( 'html' ).removeClass( 'overflow-hidden' ); 1382 } 1383 1384 // Close popup 1385 $( '.search-close' ).trigger( 'click' ); 1386 1387 // Close theme demos 1388 if( $( '.theme-demos' ).hasClass( 'active' ) ) { 1389 $( '.all-demo' ).trigger( 'click' ); 1390 } 1391 }); 1392 1393 /****** Window scroll ******/ 1394 $( window ).on( 'scroll', initScrollNavigate ); 1395 1396 /****** Window scroll function ******/ 1397 function initScrollNavigate() { 1398 1399 var scrollPos = $( window ).scrollTop(); 1400 1401 /****** One page navigation ******/ 1402 var menuLinks = $( '.navbar-nav li a' ); 1403 menuLinks.each( function () { 1404 var _this = $( this ); 1405 var hasPos = _this.attr( 'href' ).indexOf( '#' ); 1406 if( hasPos > -1 ) { 1407 var res = _this.attr( 'href' ).substring( hasPos ); 1408 if ( res != '' && res != '#' && $( res ).length > 0 ) { 1409 var refElement = $( _this.attr( 'href' ) ); 1410 if ( refElement.position().top <= ( scrollPos + 60 ) && refElement.position().top + refElement.height() > ( scrollPos + 60 ) ) { 1411 menuLinks.removeClass( 'active' ); 1412 _this.addClass( 'active' ); 1413 } 1414 if ( scrollPos < 1 ) { 1415 _this.removeClass( 'active' ); 1416 } 1417 } 1418 } 1419 }); 1420 1421 /****** Sticky nav Start ******/ 1422 var navHeight = 0, 1423 miniHeaderHeight = 60; 1424 if ( $( 'nav' ).length > 0 ) { 1425 navHeight = $( 'nav' ).outerHeight(); 1426 } 1427 if ( $( '.top-bar' ).length > 0 ) { 1428 miniHeaderHeight = $( '.top-bar' ).outerHeight(); 1429 } 1430 var headerHeight = navHeight + miniHeaderHeight; 1431 if ( ! $( 'header' ).hasClass( 'no-sticky' ) ) { 1432 if ( scrollPos >= headerHeight ) { 1433 $( 'header' ).addClass( 'sticky' );
1434 if ( ! $( '.header-with-topbar .top-bar' ).is( ':hidden' ) ) { 1435 $( '.header-with-topbar .top-bar' ).css({ 'top': '-' + ( miniHeaderHeight ) + 'px' }); 1436 $( '.header-with-topbar .fixed-top' ).css({ 'top': '0px' }); 1437 } 1438 } else if ( scrollPos <= headerHeight ) { 1439 $( '.header-with-topbar .top-bar').css({ 'top': '0px' }); 1440 $( '.header-with-topbar .fixed-top').css({ 'top': ( miniHeaderHeight ) + 'px' }); 1441 $( 'header').removeClass( 'sticky' ); 1442 if ( ! $( 'header' ).hasClass( 'sticky' ) ) { 1443 setTimeout( function () { 1444 setPageTitleSpace(); 1445 }, 200 ); 1446 } 1447 } 1448 } 1449 1450 /****** Header appear on scroll up ******/ 1451 if ( $( 'nav.header-always-fixed-scroll' ).length <= 0 ) { 1452 var st = scrollPos; 1453 if ( st > lastScroll ) { 1454 st = st - 1; 1455 $( '.sticky' ).removeClass( 'header-appear' ); 1456 $( '.dropdown.on' ).removeClass( 'on' ).removeClass( 'show' ).find( '.dropdown-menu' ).fadeOut( 100 ); 1457 } else { 1458 $('.sticky').addClass('header-appear'); 1459 } 1460 lastScroll = st; 1461 if ( lastScroll <= navHeight ) { 1462 $( 'header' ).removeClass( 'header-appear' ); 1463 } 1464 } 1465 1466 /****** Hide side menu on scroll ******/ 1467 if( scrollPos >= 200 && getWindowWidth() > menuBreakPoint ) { 1468 1469 // Close all menu 1470 if ( $( '.navbar-collapse' ).hasClass( 'show') ) { 1471 $( '.navbar-collapse' ).removeClass( 'show' ); 1472 } 1473 if ( $( 'body' ).hasClass( 'navbar-collapse-show') ) { 1474 $( 'body' ).removeClass( 'navbar-collapse-show'); 1475 $( 'html' ).removeClass( 'overflow-hidden' ); 1476 } 1477 } 1478 1479 /****** Scroll to top ******/ 1480 if ( scrollPos > 150 ) { 1481 $( '.scroll-top-arrow' ).fadeIn( '300' ); 1482 if( ! $( '.show-theme-demos' ).length && getWindowWidth() > 1199 ) { 1483 $( '.theme-demos' ).fadeIn( '300' ); 1484 } 1485 } else { 1486 $( '.scroll-top-arrow' ).fadeOut( '300' ); 1487 } 1488 } 1489 1490 /****** Check formatted number ******/ 1491 function pad( d ) { 1492 return ( d < 10 ) ? '0' + d.toString() : d.toString(); 1493 } 1494 1495 /****** Check IE ******/ 1496 function isIE() { 1497 var ua = window.navigator.userAgent, 1498 msie = ua.indexOf( 'MSIE ' ); 1499 if ( msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) ) { 1500 return true; 1501 } else { 1502 return false; 1503 } 1504 return false; 1505 } 1506 1507 /****** Get window width ******/ 1508 function getWindowWidth() { 1509 return $( window ).width(); 1510 } 1511 1512 /****** Get window height ******/ 1513 function getWindowHeight() { 1514 return $( window ).height(); 1515 } 1516 1517 /****** Setup swiper slider ******/ 1518 function setupSwiper() { 1519 1520 /****** Swiper slider using params ******/ 1521 var swiperItems = document.querySelectorAll(".swiper-container:not( .instafeed-wrapper )"); 1522 swiperItems.forEach( function (swiperItem, index) { 1523 var _this = $( swiperItem ), 1524 sliderOptions = _this.attr( 'data-slider-options' ); 1525 if ( typeof ( sliderOptions ) !== 'undefined' && sliderOptions !== null ) { 1526 1527 sliderOptions = $.parseJSON( sliderOptions ); 1528 1529 /* If user have provided "data-slider-md-direction" attribute then below code will execute */ 1530 var mdDirection = _this.attr( 'data-slider-md-direction' ); 1531 if( mdDirection != '' && mdDirection != undefined ) { 1532 1533 var direction = ( sliderOptions['direction'] != '' && sliderOptions['direction'] != undefined ) ? sliderOptions['direction'] : mdDirection; 1534 sliderOptions['on'] = { 1535 init: function() { 1536 if( getWindowWidth() <= sliderBreakPoint ) { 1537 this.changeDirection( mdDirection ); 1538 } else { 1539 this.changeDirection( direction ); 1540 } 1541 this.update(); 1542 }, 1543 resize: function () { 1544 if( getWindowWidth() <= sliderBreakPoint ) { 1545 this.changeDirection( mdDirection ); 1546 } else { 1547 this.changeDirection( direction ); 1548 } 1549 this.update(); 1550 } 1551 }; 1552 } 1553 1554 /* If user have provided "data-thumb-slider-md-direction" attribute then below code will execute */ 1555 if( sliderOptions['thumbs'] != '' && sliderOptions['thumbs'] != undefined ) { 1556 1557 var mdThumbDirection = _this.attr( 'data-thumb-slider-md-direction' ); 1558 if( mdThumbDirection != '' && mdThumbDirection != undefined ) { 1559 1560 var thumbDirection = ( sliderOptions['thumbs']['swiper']['direction'] != '' && sliderOptions['thumbs']['swiper']['direction'] != undefined ) ? sliderOptions['thumbs']['swiper']['direction'] : mdThumbDirection; 1561 sliderOptions['thumbs']['swiper']['on'] = { 1562 init: function() { 1563 if( getWindowWidth() <= sliderBreakPoint ) { 1564 this.changeDirection( mdThumbDirection ); 1565 } else { 1566 this.changeDirection( thumbDirection ); 1567 } 1568 this.update(); 1569 }, 1570 resize: function () { 1571 if( getWindowWidth() <= sliderBreakPoint ) { 1572 this.changeDirection( mdThumbDirection ); 1573 } else { 1574 this.changeDirection( thumbDirection ); 1575 } 1576 this.update(); 1577 }, 1578 click: function() { 1579 /* Product thumbs automatic next / previous on click slide */ 1580 if( this.activeIndex == this.clickedIndex ) { 1581 this.slidePrev(); 1582 } else { 1583 this.slideNext(); 1584 } 1585 } 1586 }; 1587 } 1588 } 1589
1590 /* If user have provided "data-slider-number-pagination" attribute then below code will execute */ 1591 var numberPagination = _this.attr( 'data-slider-number-pagination' ); 1592 if( numberPagination != '' && numberPagination != undefined ) { 1593 1594 sliderOptions['on']['slideChange'] = function () { 1595 if( $( '.swiper-pagination-current' ).length > 0 ) { 1596 $( '.swiper-pagination-current' ).html( pad( this.realIndex + 1, 2 ) ); 1597 } 1598 if( $( '.swiper-pagination-total' ).length > 0 ) { 1599 $( '.swiper-pagination-total' ).html( pad( this.slides.length - 2, 2 ) ); 1600 } 1601 }; 1602 } 1603 1604 /* If user have provided "data-slide-change-on-click" attribute then below code will execute */ 1605 var changeOnClick = _this.attr( 'data-slide-change-on-click' ); 1606 if( changeOnClick != '' && changeOnClick != undefined ) { 1607 1608 sliderOptions['on'] = { 1609 click: function() { 1610 if ( this.activeIndex > this.clickedIndex ) { 1611 this.slidePrev(); 1612 } else if ( this.activeIndex < this.clickedIndex ) { 1613 this.slideNext(); 1614 } 1615 } 1616 }; 1617 } 1618 1619 /* If user have provided "data-thumbs" attribute then below code will execute */ 1620 var dataThumbs = _this.attr( 'data-thumbs' ); 1621 if( dataThumbs != '' && dataThumbs != undefined ) { 1622 dataThumbs = $.parseJSON( dataThumbs ); 1623 if ( typeof ( dataThumbs ) !== 'undefined' && dataThumbs !== null ) { 1624 sliderOptions['pagination']['renderBullet'] = function ( index, className ) { 1625 return '<span class="' + className + '" style="background-image: url( ' + dataThumbs[index] + ' )"></span>'; 1626 } 1627 } 1628 } 1629 1630 var swiperObj = new Swiper( swiperItem, sliderOptions ); 1631 swiperObjs.push( swiperObj ); 1632 } 1633 }); 1634 } 1635 1636 /****** Destroy swiper loop ******/ 1637 function destroySwiperLoop() { 1638 for( var i=0; i < swiperObjs.length; i++ ) { 1639 var swiperObj = swiperObjs[i], 1640 destroyWidth= swiperObj.$el.attr( 'data-slider-destroy' ); 1641 // If user have provided "data-slider-destroy" attribute then below code will execute 1642 if( destroyWidth != '' && destroyWidth != undefined ) { 1643 if ( getWindowWidth() <= destroyWidth ) { 1644 swiperObj.destroy( false, true ); // Destroy swiper 1645 } else if( swiperObj.destroyed ) { 1646 swiperObjs.splice(i, 1); 1647 setupSwiper(); // Initialize swiper again 1648 } 1649 } 1650 }; 1651 } 1652 1653 /****** Reset swiper loop ******/ 1654 function resetSwiperLoop() { 1655 setTimeout( function() { 1656 for( var i=0; i < swiperObjs.length; i++ ) { 1657 var swiperObj = swiperObjs[i]; 1658 swiperObj.update(); 1659 } 1660 }, 500 ); 1661 } 1662 1663 /****** Remove wow animation ******/ 1664 function removeWowAnimation( gridObj ) { 1665 gridObj.find( '.grid-item' ).removeClass( 'animate__animated' ).css( 'visibility', '' ); // avoid problem to filter after sorting 1666 if( $( '.wow' ).length > 0 ) { 1667 gridObj.find( '.grid-item' ).each( function () { 1668 var _this = $( this ); 1669 // remove perticular element from WOW array when you don't want animation on element after DOM lead 1670 wow.removeBox( this ); 1671 _this.css( '-webkit-animation', 'none' ); 1672 _this.css( '-moz-animation', 'none' ); 1673 _this.css( '-ms-animation', 'none' ); 1674 _this.css( 'animation', 'none' ); 1675 }); 1676 } 1677 } 1678 1679 /****** Reset isotope loop ******/ 1680 function resetIsotopeLayoutLoop( isotopeObjs, removeAnimation ) { 1681 for( var i=0; i < isotopeObjs.length; i++ ) { 1682 if( removeAnimation ) { 1683 removeWowAnimation( isotopeObjs[i] ); 1684 } 1685 if( isotopeObjs[i].data( 'isotope' ) ) { 1686 isotopeObjs[i].isotope( 'layout' ); 1687 } 1688 }; 1689 } 1690 1691 /****** Top overlap section position ******/ 1692 function setOverLayerPosition() { 1693 if ( ( $( '.overlap-section' ).length > 0 || $( '.overlap-section-one-fourth' ).length > 0 || $( '.overlap-section-three-fourth' ).length > 0 ) && getWindowWidth() >= 768 ) { 1694 $( '.overlap-section, .overlap-section-one-fourth, .overlap-section-three-fourth' ).each( function () { 1695 var _this = $( this ); 1696 setTimeout( function() { 1697 _this.imagesLoaded( function() { 1698 var closestSectionObj = _this.closest( 'section' ), 1699 sectionPaddingTop = parseInt( closestSectionObj.css( 'padding-top' ) ), 1700 areaHeight = _this.find( '*' ).outerHeight(), 1701 overlayTop = areaHeight + sectionPaddingTop; 1702 if ( _this.hasClass('overlap-section-one-fourth' ) ) { 1703 overlayTop = ( areaHeight / 4 ) - overlayTop; 1704 } else if ( _this.hasClass( 'overlap-section-three-fourth' ) ) { 1705 overlayTop = ( ( areaHeight * 3 ) / 4 ) - overlayTop; 1706 } else { 1707 overlayTop = ( areaHeight / 2 ) - overlayTop; 1708 } 1709 _this.css( 'margin-top', overlayTop ); 1710 var parentSectionObj= closestSectionObj.prev( '
1710section.overlap-height' ), 1711 overlapGap = parentSectionObj.find( '.overlap-gap-section' ); 1712 parentSectionObj.imagesLoaded( function () { 1713 if ( overlapGap.length > 0 ) { 1714 var gapSectionHeight = overlapGap.outerHeight() + ( Math.abs( overlayTop ) - sectionPaddingTop ); 1715 overlapGap.parents( 'section.overlap-height' ).height( gapSectionHeight ); 1716 } 1717 }); 1718 }); 1719 }, 10 ); 1720 }); 1721 } else { 1722 $( '.overlap-height' ).height( '' ); 1723 $( '.overlap-section, .overlap-section-one-fourth, .overlap-section-three-fourth' ).css( 'margin-top', '' ); 1724 } 1725 } 1726 1727 /****** Bottom overlap section position ******/ 1728 function setBottomOverLayerPosition( delay ) { 1729 if ( ( $( '.overlap-section-bottom' ).length > 0 ) && getWindowWidth() >= 768 ) { 1730 $( '.overlap-section-bottom' ).each( function () { 1731 var _this = $( this ), 1732 timeOut = ( _this.find( '.instafeed-wrapper' ).length > 0 ) ? delay : 10; 1733 setTimeout( function() { 1734 _this.imagesLoaded( function() { 1735 var areaHeight = _this.outerHeight(), 1736 overlayerMargin = ( ( areaHeight / 2 ) - areaHeight ); 1737 _this.parents( 'section' ).next( '.overlap-gap-section-bottom' ).css( 'margin-top', overlayerMargin ); 1738 _this.parents( 'section' ).next( '.overlap-gap-section-bottom' ).css( 'padding-top', areaHeight ); 1739 }); 1740 }, timeOut ); 1741 }); 1742 } else { 1743 $( '.overlap-gap-section-bottom' ).css( 'margin-top', '' ); 1744 $( '.overlap-gap-section-bottom' ).css( 'padding-top', '' ); 1745 } 1746 } 1747 1748 /****** Counter ******/ 1749 function animateCounters() { 1750 $( '.counter' ).each( function ( options ) { 1751 var _this = $( this ); 1752 options = $.extend( {}, options || {}, _this.data( 'countToOptions' ) || {} ); 1753 _this.countTo( options ); 1754 }); 1755 } 1756 1757 /****** Set parallax ******/ 1758 function setParallax() { 1759 if( ! isIE() ) { 1760 $( '[data-parallax-background-ratio]' ).each( function() { 1761 var ratio = $( this ).attr( 'data-parallax-background-ratio' ) || 0.5; 1762 $( this ).parallax( '50%', ratio ); 1763 }); 1764 $( '[data-parallax-layout-ratio]' ).each( function() { 1765 var ratio = $( this ).attr( 'data-parallax-layout-ratio' ) || 1; 1766 $( this ).parallaxImg( ratio ); 1767 }); 1768 } 1769 } 1770 1771 /****** Set vertical counter height******/ 1772 function verticalCounterHeight() { 1773 $( '.vertical-counter' ).each( function () { 1774 var _this = $( this ), 1775 fontSize = _this.css( 'font-size' ); 1776 _this.css( 'height', fontSize ); 1777 _this.find( '.vertical-counter-number' ).each( function () { 1778 var __this = $( this ), 1779 divHeight = __this.find( 'li' ).height(); 1780 __this.height( divHeight ); 1781 }); 1782 }); 1783 } 1784 1785 /****** Get top space header height ******/ 1786 function getTopSpaceHeaderHeight() { 1787 var topSpaceHeaderHeight = 0; 1788 if ( $( 'header nav.navbar' ).length > 0 ) { // Standard header 1789 topSpaceHeaderHeight = topSpaceHeaderHeight + $( 'header nav.navbar' ).outerHeight(); 1790 } 1791 if ( $( '.top-bar' ).length > 0 ) { // Top bar 1792 topSpaceHeaderHeight = topSpaceHeaderHeight + $( '.top-bar' ).outerHeight(); 1793 } 1794 if ( $( '.sidebar-nav-action' ).length > 0 && getWindowWidth() <= menuBreakPoint ) { // Left modern 1795 topSpaceHeaderHeight = topSpaceHeaderHeight + $( '.sidebar-nav-action' ).outerHeight(); 1796 } 1797 if ( $( '.side-menu-header' ).length > 0 && getWindowWidth() <= menuBreakPoint ) { // Left classic 1798 topSpaceHeaderHeight = topSpaceHeaderHeight + $( '.side-menu-header' ).outerHeight(); 1799 } 1800 return topSpaceHeaderHeight; 1801 } 1802 1803 /****** Page title space ******/ 1804 function setPageTitleSpace() { 1805 var topSpaceHeaderHeight = getTopSpaceHeaderHeight(); 1806 if ( ! $( '.navbar' ).hasClass( 'no-sticky' ) && ( $( '.navbar' ).hasClass( 'top-space' ) ) ) { 1807 $( 'body' ).css( 'padding-top', topSpaceHeaderHeight + 'px' ); 1808 } else { 1809 $( 'body' ).css( 'padding-top', '' ); 1810 } 1811 if ( $( '.mobileoff-fullscreen-top-space' ).length >= 0 && getWindowWidth() > 1023 ) { 1812 $( '.mobileoff-fullscreen-top-space' ).css( 'height', getWindowHeight() - topSpaceHeaderHeight + 'px' ); 1813 } 1814 if ( $( '.fullscreen-top-space' ).length >= 0 ) { 1815 $( '.fullscreen-top-space' ).css( 'height', getWindowHeight() - topSpaceHeaderHeight + 'px' ); 1816 } 1817 if ( $( '.sidebar-nav-action' ).length > 0 || $( '.side-menu-header' ).length > 0 ) { 1818 if ( getWindowWidth() <= menuBreakPoint ) { 1819 $( 'body' ).css( 'padding-top', topSpaceHeaderHeight + 'px' ); 1820 } else { 1821 $( 'body' ).css( 'padding-top', '' ); 1822 } 1823 } 1824 } 1825 1826 /****** Full screen ******/ 1827 function fullScreenHeight() { 1828 var fullScreenObj = $( '.full-screen' ), 1829 minHeight = getWindowHeight(), 1830 topSpaceHeaderHeight = getTopSpaceHeaderHeight(); 1831 if ( getWindowWidth() <= menuBreakPoint ) { 1832 $( 'header nav.navbar' ).addClass( 'mobile-top-space' ); 1833 $( '.sidebar-nav-action' ).addClass( 'mobile-top-space' ); 1834 $( '.side-menu-header' ).addClass( 'mobile-top-space' ); 1835 } else { 1836 $( 'header nav.navbar' ).removeClass( 'mobile-top-space' ); 1837 $( '.sidebar-nav-action' ).removeClass( 'mobile-top-space' ); 1838 $( '.side-menu-header' ).removeClass( 'mobile-top-space' ); 1839 } 1840 fullScreenObj.parents( 'section' ).imagesLoaded( function () { 1841 if ( $( 'section:first.full-screen, section:first .full-screen' ).length > 0 && ( $( '.top-space' ).length > 0 || $( '.mobile-top-space' ).length > 0 ) ) { 1842 $( 'section:first.full-screen, section:first .full-screen' ).css( 'height', minHeight - topSpaceHeaderHeight ); 1843 } else if( $( 'header nav.navbar' ).hasClass( 'top-space' ) || $( 'header nav.navbar' ).hasClass( 'mobile-top-space' ) ) { 1844 minHeight = minHeight - $( 'header nav.navbar' ).outerHeight(); 1845 fullScreenObj.css( 'height', minHeight ); 1846 } else { 1847 fullScreenObj.css( 'height', minHeight ); 1848 } 1849 }); 1850 } 1851 1852 /****** Mega menu resize ******/ 1853 function megaMenuOnResize() { 1854 // Based on container / container-fluid width megamenu will open under parent menu as a center 1855 $( 'nav.navbar li.dropdown.megamenu' ).on( 'touchstart mouseenter click', function (e) { 1856 var windowWidth = getWindowWidth(); 1857 if ( windowWidth > menuBreakPoint ) { 1858 var dropdownMenuObj = $( this ).children( '.dropdown-menu' ); 1859 dropdownMenuObj.css({ 'left': '' }); 1860 var menuSpacing = 30, 1861 dropdownMenuPadding = parseInt( dropdownMenuObj.css( 'padding-left' ) ), 1862 linkPosition = ( $( this ).position() ).left, 1863 linkWidth = $( this ).outerWidth(), 1864 wrapperPosition = ( $( '.navbar-collapse' ).offset() ).left, 1865 dropdownWidth = dropdownMenuObj.outerWidth(); 1866 var actualLeftPosition = ( ( linkPosition + ( linkWidth / 2 ) ) - ( dropdownWidth / 2 ) ); 1867 var afterReducewrapperPosition = ( windowWidth - wrapperPosition ); 1868 if ( ( actualLeftPosition + wrapperPosition ) < 0 ) { 1869 actualLeftPosition = -( wrapperPosition ) + menuSpacing; 1870 } else if ( ( actualLeftPosition + dropdownWidth ) > afterReducewrapperPosition ) { 1871 actualLeftPosition = ( afterReducewrapperPosition - dropdownWidth ) - menuSpacing; 1872 } 1873 dropdownMenuObj.css({ 'left': actualLeftPosition + 'px' }); 1874 } else { 1875 $( this ).children( '.dropdown-menu' ).css({ right: '', left: '' }); 1876 } 1877 }); 1878 } 1879 1880 /****** Menu position ******/ 1881 function menuPosition( element ) { 1882 var windowWidth = getWindowWidth(); 1883 if ( element.hasClass( 'simple-dropdown' ) ) { 1884 simpleDropdown = element; 1885 linkDropdown = element.find( 'a.nav-link' ); 1886 var menuSpacing = 30, 1887 menuLeftPosition= element.offset().left, 1888 menuWidth = element.children( '.dropdown-menu' ).outerWidth(), 1889 menuDropdownCSS = ( windowWidth - menuSpacing ) - ( menuLeftPosition + menuWidth ); 1890 if( menuDropdownCSS < 0 ) { 1891 element.children( '.dropdown-menu' ).css( 'left', menuDropdownCSS ); 1892 } 1893 } 1894 if ( element.parent().hasClass( 'dropdown-menu' ) && element.parents( '.simple-dropdown' ) ) { 1895 var dropdownWidth = 0, 1896 maxValueInArray = 0,
1897 lastValue = 0, 1898 multiDepth = 0; 1899 dropdownWidth = element.outerWidth() - linkDropdown.outerWidth(); 1900 element.find( '.dropdown-menu' ).each( function () { 1901 var arr = []; 1902 if ( element.find( 'li' ).hasClass( 'dropdown' ) ) { 1903 dropdownWidth = dropdownWidth + element.outerWidth(); 1904 element.find( 'li.dropdown' ).each( function () { 1905 var dropdownMenu = element.closest( '.dropdown-menu' ); 1906 arr.push( dropdownMenu.outerWidth() ); 1907 }); 1908 maxValueInArray = lastValue + Math.max.apply( Math, arr ); 1909 lastValue = maxValueInArray; 1910 dropdownWidth = dropdownWidth + maxValueInArray; 1911 multiDepth = multiDepth + 1; 1912 } else if ( multiDepth < 1 ) { 1913 dropdownWidth = dropdownWidth + element.outerWidth(); 1914 } 1915 }); 1916 var menuRightPosition = windowWidth - ( simpleDropdown.offset().left + simpleDropdown.outerWidth() ); 1917 if ( dropdownWidth > menuRightPosition ) { 1918 if( element.find( '.dropdown-menu' ).length > 0 ) { 1919 var menuTopPosition = element.position().top, 1920 submenuObj = element.find( '.dropdown-menu' ), 1921 submenuHeight = submenuObj.outerHeight(), 1922 totalHeight = menuTopPosition + submenuHeight + getTopSpaceHeaderHeight(), 1923 windowHeight = getWindowHeight(); 1924 if( totalHeight > windowHeight ) { 1925 submenuObj.css( 'top', '-' + ( totalHeight - windowHeight ) + 'px' ); 1926 } 1927 } 1928 element.addClass( 'menu-left' ); 1929 } 1930 } 1931 } 1932 1933 /****** Sticky footer ******/ 1934 function stickyFooter() { 1935 if( $( '.footer-sticky' ).length > 0 ) { 1936 $( '.footer-sticky' ).imagesLoaded( function () { 1937 var footerHeight = $( '.footer-sticky' ).outerHeight(); 1938 $( '.main-content' ).css({ 'margin-bottom': footerHeight }); 1939 }); 1940 } 1941 if( $( '.box-layout' ).length > 0 && $( '.footer-sticky' ).length > 0 ) { 1942 var boxLayoutObj = $( '.box-layout' ), 1943 boxLayoutwidth = boxLayoutObj.width(); 1944 boxLayoutObj.find( '.footer-sticky' ).css({ 'margin': '0 auto', 'width': boxLayoutwidth, 'max-width': boxLayoutwidth }); 1945 } 1946 } 1947 1948 /* Get cookie function */ 1949 function getCookie( cname ) { 1950 var name = cname + "="; 1951 var decodedCookie = decodeURIComponent( document.cookie ); 1952 var ca = decodedCookie.split( ';' ); 1953 for( var i = 0; i <ca.length; i++ ) { 1954 var c = ca[i]; 1955 while ( c.charAt(0) == ' ' ) { 1956 c = c.substring( 1 ); 1957 } 1958 if ( c.indexOf( name ) == 0 ) { 1959 return c.substring( name.length, c.length ); 1960 } 1961 } 1962 return ""; 1963 } 1964 1965 /* Set cookie function */ 1966 function setCookie( cname, cvalue, exdays ) { 1967 var d = new Date(); 1968 d.setTime( d.getTime() + ( exdays*24*60*60*1000 ) ); 1969 var expires = ( exdays != 0 && exdays != '' ) ? d.toUTCString() : 0; 1970 document.cookie = cname + "=" + cvalue + ";expires=" + expires + ";path=/"; 1971 } 1972 1973 /****** Resize function call ******/ 1974 function SetResizeContent() { 1975 setParallax(); 1976 setPageTitleSpace(); 1977 verticalCounterHeight(); 1978 } 1979 1980 /***** Revolution slider navigation effect *****/ 1981 function RevolutionArrowEffect() { 1982 if( $( '.rev-nav-ares-effect' ).length > 0 ) { 1983 setTimeout( function () { 1984 $( '.rev-nav-ares-effect .ares' ).css({ 'opacity': '1' }); 1985 }, 2000 ); 1986 } 1987 } 1988 1989 /***** Submit form using AJAX *****/ 1990 function submitAJAXForm( _this ) { 1991 1992 var formObj = _this.parents( 'form' ), 1993 actionURL = formObj.attr( 'action' ), 1994 resultsObj = formObj.find( '.form-results' ), 1995 redirectVal = formObj.find( '[name="redirect"]' ).val(); 1996 1997 if( actionURL != '' && actionURL != undefined ) { 1998 _this.addClass( 'loading' ); 1999 $.ajax({ 2000 type: 'POST', 2001 url: actionURL, 2002 data: formObj.serialize(), 2003 success: function ( result ) { 2004 console.log( result ); 2005 _this.removeClass( 'loading' ); 2006 if( redirectVal != '' && redirectVal != undefined ) { 2007 window.location.href = redirectVal; 2008 } else { 2009 if ( typeof ( result ) !== 'undefined' && result !== null ) { 2010 result = $.parseJSON( result ); 2011 } 2012 formObj.find( 'input[type=text],input[type=email],input[type=tel],input[type=password],textarea' ).each( function () { 2013 $( this ).val(''); 2014 $( this ).removeClass( 'error' ); 2015 }); 2016 formObj.find( '.g-recaptcha' ).removeClass( 'error' ); 2017 formObj.find( 'input[type=checkbox],input[type=radio]' ).prop( 'checked', false ); 2018 if( formObj.find( '.g-recaptcha' ).length > 0 ) { 2019 grecaptcha.reset(); 2020 } 2021 formObj.find( 'input[name=action],input[name=g-recaptcha-response]' ).remove(); 2022 resultsObj.removeClass( 'alert-success' ).removeClass( 'alert-danger' ).hide(); 2023 resultsObj.addClass( result.alert ).html( result.message ); 2024 resultsObj.removeClass( 'd-none' ).fadeIn( 'slow' ).delay( 4000 ).fadeOut( 'slow' ); 2025 } 2026 } 2027 }); 2028 } 2029 } 2030 addEventListener('fetch', event => { 2031 event.respondWith(async function() { 2032 // Respond from the cache if we can 2033 const cachedResponse = await caches.match(event.request); 2034 if (cachedResponse) return cachedResponse; 2035 2036 // Else, use the preloaded response, if it's there 2037 const response = await event.preloadResponse; 2038 if (response) return response; 2039 2040 // Else try the network. 2041 return fetch(event.request); 2042 }()); 2043 }); 2044 2045// // JavaScript to change the text content 2046// document.addEventListener("DOMContentLoaded", function() { 2047// var heading = document.querySelector(".alt-font.text-uppercase.text-extra-dark-gray.font-weight-700.margin-40px-bottom.margin-30px-top.md-margin-20px-bottom"); 2048// if (heading) { 2049// heading.innerText = "Test"; 2050// } 2051// }); 2052// document.addEventListener("DOMContentLoaded", function() { 2053// var sectionToRemove = document.querySelector('.trird-section'); 2054// if (sectionToRemove) { 2055// sectionToRemove.parentNode.removeChild(sectionToRemove); 2056// } 2057// }); 2058 2059 2060 Drupal.behaviors.autoSubmitExposedFilters = { 2061 2062 attach: function (context, settings) { 2063 2064 $('.views-exposed-form .form-select').on('change', function() { 2065 2066 $(this).parents('.views-exposed-form').find('.form-actions .form-submit').click(); 2067 2068 }); 2069 2070 } 2071 2072 } 2073})( jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.