1( function( $ ) { 2 3 "use strict"; 4 5 // Tablet Breakpoint 6 var tabletBreakPoint = 1024; 7 if ( typeof LithoMain.breakpoints != "undefined" ) { 8 if ( typeof LithoMain.breakpoints.lg != "undefined" ) { 9 tabletBreakPoint = LithoMain.breakpoints.lg - 1; 10 } 11 } 12 13 // define varibale 14 var lastScroll = 0, 15 simpleDropdown = 0, 16 linkDropdown = 0; 17 18 // Check for browser OS 19 var isMobile = false, 20 isiPhoneiPad = false; 21 22 if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( navigator.userAgent ) ) { 23 isMobile = true; 24 } 25 if ( /iPhone|iPad|iPod/i.test(navigator.userAgent ) ) { 26 isiPhoneiPad = true; 27 } 28 29 // Check safari browser 30 var is_safari = /^((?!chrome|android).)*safari/i.test( navigator.userAgent ); 31 32 // Check IE 33 function isIE() { 34 var ua = window.navigator.userAgent, 35 msie = ua.indexOf( 'MSIE ' ); 36 if ( msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) ) { 37 return true; 38 } else { 39 return false; 40 } 41 return false; 42 } 43 44 // Get window width 45 function getWindowWidth() { 46 return $( window ).width(); 47 } 48 49 // Get window height 50 function getWindowHeight() { 51 return $( window ).height(); 52 } 53 54 function headerWrapper( scrollTop ) { 55 56 var mini_header_height = 0, 57 main_header_height = 0, 58 mini_header_ts_height = 0, 59 main_header_ts_height = 0, 60 wpadminbarHeight = 0, 61 aboveHeaderHeight = 0, 62 ts_height = 0; 63 64 65 if ( $( '.admin-bar #wpadminbar' ).length > 0 ) { 66 67 wpadminbarHeight = $( '.admin-bar #wpadminbar' ).outerHeight(); 68 wpadminbarHeight = Math.round( wpadminbarHeight ); 69 } 70 71 if ( $( '.mini-header-main-wrapper' ).length > 0 ) { 72 73 var mini_header_object = $( '.mini-header-main-wrapper' ); 74 mini_header_height = mini_header_object.outerHeight(); 75 ts_height = ts_height + mini_header_height; 76 } 77 78 if ( $( '.header-common-wrapper.standard' ).length > 0 ) { 79 80 var main_header_object = $( '.header-common-wrapper.standard' ); 81 main_header_height = main_header_object.outerHeight(); 82 main_header_object.css( 'margin-top', ts_height ); 83 ts_height = ts_height + main_header_height; 84 } 85 86 var headerAppearFlag = false; 87 if ( scrollTop > ts_height ) { // Scroll position is greater than header height 88 headerAppearFlag = true; 89 } 90 91 if ( $( '.mini-header-main-wrapper' ).length > 0 ) { 92 93 var mini_header_object = $( '.mini-header-main-wrapper' ); 94 mini_header_object.css( 'margin-top', '0px' ); 95 96 if ( mini_header_object.hasClass( 'appear-up-scroll' ) ) { 97 98 if ( scrollTop > lastScroll ) { 99 100 scrollTop = scrollTop - 1; 101 102 if ( headerAppearFlag ) { 103 104 mini_header_object.css( 'top', '-' + ( ts_height ) + 'px' ); 105 } 106 mini_header_object.removeClass( 'header-appear' ); 107 108 } else { 109 110 if ( headerAppearFlag ) { 111 112 aboveHeaderHeight = aboveHeaderHeight + mini_header_height; 113 } 114 mini_header_object.addClass( 'header-appear' ); 115 mini_header_object.css( 'top', wpadminbarHeight + 'px' ); 116 } 117 118 } else if ( mini_header_object.hasClass( 'appear-down-scroll' ) ) { 119 120 if ( headerAppearFlag && ! $( '.header-common-wrapper.standard' ).hasClass( 'no-sticky' ) ) { 121 122 aboveHeaderHeight = aboveHeaderHeight + mini_header_height; 123 124 } else if ( scrollTop > aboveHeaderHeight && $( '.header-common-wrapper.standard' ).hasClass( 'no-sticky' ) ) { 125 mini_header_object.css( 'margin-top', aboveHeaderHeight + 'px' ); 126 } 127 } 128 } 129 130 if ( $( '.header-common-wrapper.standard' ).length > 0 ) { 131 132 var main_header_object = $( '.header-common-wrapper' ); 133 main_header_height = main_header_object.outerHeight(); 134 135 if ( ! main_header_object.hasClass( 'no-sticky' ) ) { 136 if ( headerAppearFlag && scrollTop > 0 ) { 137 main_header_object.css( 'margin-top', aboveHeaderHeight + 'px' ); 138 139 } else if ( scrollTop > aboveHeaderHeight && $( '.mini-header-main-wrapper' ).hasClass( 'no-sticky' ) ) { 140 141 main_header_object.css( 'margin-top', aboveHeaderHeight + 'px' ); 142 } 143 } 144
145 if ( main_header_object.hasClass( 'appear-up-scroll' ) ) { 146 147 if ( scrollTop > lastScroll ) { 148 149 scrollTop = scrollTop - 1; 150 151 if ( headerAppearFlag ) { 152 153 main_header_object.css( 'top', '-' + ( ts_height ) + 'px' ); 154 } 155 main_header_object.removeClass( 'header-appear' ); 156 157 } else { 158 159 main_header_object.addClass( 'header-appear' ); 160 main_header_object.css( 'top', wpadminbarHeight + 'px' ); 161 } 162 163 } else if ( main_header_object.hasClass( 'appear-down-scroll' ) ) { 164 165 if ( headerAppearFlag && ! $( '.mini-header-main-wrapper' ).hasClass( 'no-sticky' ) ) { 166 167 aboveHeaderHeight = aboveHeaderHeight + main_header_height; 168 169 } else if ( scrollTop > aboveHeaderHeight && $( '.mini-header-main-wrapper' ).hasClass( 'no-sticky' ) ) { 170 main_header_object.css( 'margin-top', aboveHeaderHeight + 'px' ); 171 } 172 } 173 } 174 175 if ( scrollTop > ts_height ) { 176 177 $( 'header.site-header' ).addClass( 'sticky' ); 178 179 } else { 180 181 $( 'header.site-header' ).removeClass( 'sticky' ); 182 $( '.mini-header-main-wrapper, .header-common-wrapper' ).removeClass( 'header-appear' ); 183 } 184 185 lastScroll = scrollTop; 186 187 // Scroll to top 188 if ( scrollTop > 150 ) { 189 $( '.scroll-top-arrow' ).fadeIn( 'slow' ); 190 $( '.theme-demos' ).css( 'display', 'block' ); 191 } else { 192 $( '.scroll-top-arrow' ).fadeOut( 'slow' ); 193 } 194 } 195 196 $( window ).on( 'load', function () { 197 // Non retina image code 198 $( 'img:not([data-at2x])' ).each( function() { 199 $( this ).attr( 'data-no-retina', '' ); 200 }); 201 }); 202 203 // document ready event 204 $( document ).ready( function () { 205 206 var scrollTop = $( this ).scrollTop(); 207 headerWrapper( scrollTop ); 208 209 // one page scroll 210 if ( $( '.inner-link' ).length > 0 ) { 211 $( '.inner-link' ).smoothScroll( { 212 speed: 900, 213 offset: 1, 214 beforeScroll: function() { $( '.navbar-collapse.collapse' ).collapse( 'hide' ); } 215 }); 216 } 217 218 if ( scrollTop == 0 ) { 219 var firstmenuLinks = $( '.navbar-nav li:first-child a' ); 220 if ( firstmenuLinks.attr( 'href' ) && firstmenuLinks.attr( 'href' ).indexOf( '#' ) > -1 ) { 221 firstmenuLinks.addClass( 'active' ); 222 } 223 } 224 225 // swiper slider for single post page 226 if ( $( '.litho-post-single-slider' ).length > 0 ) { 227 var swiperFull = new Swiper( '.litho-post-single-slider', { 228 loop: true, 229 autoplay: { 230 delay: 5000, 231 }, 232 keyboard: { 233 enabled: true, 234 onlyInViewport: true, 235 }, 236 slidesPerView: 1, 237 keyboardControl: true, 238 preventClicks: false, 239 watchOverflow: true, 240 navigation: { 241 nextEl: '.swiper-button-next', 242 prevEl: '.swiper-button-prev', 243 }, 244 on: { 245 resize: function () { 246 this.update(); 247 } 248 } 249 }); 250 } 251 252 // fit videos 253 if ( $( '.fit-videos' ).length > 0 ) { 254 255 $( '.fit-videos' ).fitVids(); 256 } 257 258 // mini cart 259 if ( $( '.site-header .litho-mini-cart-lists-wrap' ).length > 0 ) { 260 261 lithoCustomVerticalScroll( '.site-header .litho-mini-cart-lists-wrap' ); 262 } 263 264 /* Successfully loaded cart */ 265 $( document.body ).on( 'wc_fragments_loaded', function( event, fragments, cart_hash, $button ) { 266 267 lithoCustomVerticalScroll( '.site-header .litho-mini-cart-lists-wrap' ); 268 }); 269 270 /* Update Custom scroll bar after hover mini cart */ 271 $( document ).on( 'mouseenter', '.widget_shopping_cart_content', function() { 272 273 lithoCustomVerticalScroll( '.site-header .litho-mini-cart-lists-wrap' ); 274 }); 275 276 /* Custom Vertical Scroll Bar Function */ 277 function lithoCustomVerticalScroll( key ) { 278 279 if ( typeof key === "undefined" || key === null || key === '' ) { 280 key = '.site-header .litho-mini-cart-lists-wrap'; 281 } 282 283 /* Vertical Custom Scrollbar - mini cart */ 284 $( key ).mCustomScrollbar({ 285 286 theme: "dark", 287 scrollInertia: 100, 288 scrollButtons:{ 289 enable:false 290 }, 291 keyboard:{ 292 enable: true 293 }, 294 mouseWheel:{ 295 enable:true, 296 scrollAmount:200 297 }, 298 advanced:{ 299 updateOnContentResize:true, /*auto-update scrollbars on content resize (for dynamic content): boolean*/ 300 autoExpandHorizontalScroll:true, /*auto-expand width for horizontal scrolling: boolean*/ 301 } 302 }); 303 } 304 305 // Tooltip for all tooltips 306 if ( $( '.litho-tooltip' ).length > 0 ) { 307 308 $( '.litho-tooltip' ).tooltip({ boundary: 'window' }); 309 } 310 311 // tiltbox 312 if ( $( '.tilt-box' ).length > 0 && ! isMobile ) { 313 $( '.tilt-box' ).each( function () { 314 var _self = $( this ); 315 _self.tilt( { 316 maxTilt: 20, 317 perspective: 1000, 318 easing: 'cubic-bezier(.03,.98,.52,.99)', 319 scale: 1, 320 speed: 500, 321 transition: true, 322 reset: true, 323 glare: false, 324 disableAxis: null, 325 maxGlare: 1 326 }); 327 }); 328 } 329 330 // GDPR 331 var gdpr_cookie_name = 'litho_gdpr_cookie_notice_accepted' + Litho
331Main.site_id, 332 div_wrap = $( '.litho-cookie-policy-wrapper' ); 333 334 if ( typeof getLithoCookie( gdpr_cookie_name ) != 'undefined' && getLithoCookie( gdpr_cookie_name ) ) { 335 div_wrap.addClass( 'banner-visited' ); 336 div_wrap.remove(); 337 }else{ 338 div_wrap.removeClass( 'banner-visited' ); 339 } 340 341 $( '.litho-cookie-policy-button' ).on( 'click', function() { 342 div_wrap.remove(); 343 setLithoCookie( gdpr_cookie_name, 'visited', '7' ); 344 }); 345 346 /* Set litho Cookie Function */ 347 function setLithoCookie( cname, cvalue, exdays ) { 348 var d = new Date(); 349 d.setTime( d.getTime() + ( exdays*24*60*60*1000 ) ); 350 var expires = ( exdays != 0 && exdays != '' ) ? d.toUTCString() : 0; 351 document.cookie = cname + "=" + cvalue + ";expires=" + expires + ";path=/"; 352 } 353 354 /* Remove litho Cookie Function */ 355 function getLithoCookie( cname ) { 356 var name = cname + "="; 357 var decodedCookie = decodeURIComponent( document.cookie ); 358 var ca = decodedCookie.split(';'); 359 for ( var i = 0; i < ca.length; i++ ) { 360 var c = ca[i]; 361 while ( c.charAt(0) == ' ' ) { 362 c = c.substring(1); 363 } 364 if ( c.indexOf(name) == 0 ) { 365 return c.substring( name.length, c.length ); 366 } 367 } 368 return ""; 369 } 370 371 // Comment form validation 372 $( '.comment-button' ).on( 'click', function () { 373 374 var fields; 375 fields = ""; 376 var _grandParent = $( this ).parent().parent(); 377 378 if ( _grandParent.find( '#author' ).length == 1 ) { 379 if ( $( '#author' ).val().length == 0 || $( '#author' ).val().value == '' ) 380 { 381 fields ='1'; 382 $( '#author' ).addClass( 'inputerror' ); 383 } 384 } 385 if ( _grandParent.find( '#comment' ).length == 1 ) { 386 if ( $( '#comment' ).val().length == 0 || $( '#comment' ).val().value == '' ) 387 { 388 fields ='1'; 389 $( '#comment' ).addClass( 'inputerror' ); 390 } 391 } 392 if ( _grandParent.find( '#email' ).length == 1 ) { 393 if ( $( '#email' ).val().length == 0 || $( '#email' ).val().length == '' ) 394 { 395 fields ='1'; 396 $( '#email' ).addClass( 'inputerror' ); 397 398 } else { 399 var re = new RegExp(); 400 re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; 401 var sinput ; 402 sinput= "" ; 403 sinput = $( '#email' ).val(); 404 if ( !re.test( sinput ) ) { 405 fields ='1'; 406 $( '#email' ).addClass( 'inputerror' ); 407 } 408 } 409 } 410 if ( fields != "" ) { 411 return false; 412 } else { 413 return true; 414 } 415 }); 416 417 $( '.comment-field' ).on( 'keyup', function( e ) { 418 var id = $( this ).attr('id'); 419 if ( id ) { 420 $( '#' + id ).removeClass( 'inputerror' ); 421 } 422 }); 423 424 /* Side Icon */ 425 $( '.theme-demos' ).find( '.portfolio-grid' ).removeClass('portfolio-grid'); 426 $( document ).on( 'click', '.all-demo', function() { 427 428 if ( $( 'body' ).hasClass( 'overflow-hidden' ) ) { 429 $( 'body' ).removeClass( 'overflow-hidden' ); 430 } else { 431 $( 'body' ).addClass( 'overflow-hidden' ); 432 } 433 434 var themeDemosObj = $( this ).parents( '.theme-demos' ); 435 themeDemosObj.find( '.grid-loading' ).removeClass( 'grid-loading' ); 436 437 if ( ! themeDemosObj.hasClass( 'show' ) ) { 438 themeDemosObj.addClass( 'show' ); 439 var themeDemosScrollObj = themeDemosObj.find( '.demos-wrapper' ); 440 var scrollOptions = themeDemosScrollObj.attr( 'data-scroll-options' ) || '{ "theme": "dark" }'; 441 if ( typeof ( scrollOptions ) !== 'undefined' && scrollOptions !== null ) { 442 scrollOptions = $.parseJSON( scrollOptions ); 443 themeDemosScrollObj.mCustomScrollbar( scrollOptions ); 444 } 445 } else { 446 themeDemosObj.removeClass( 'show' ); 447 } 448 }); 449 /* END Side Icon */ 450 451 /* Other Video magnific popup */ 452 if ( ( $( '.popup-youtube' ).length > 0 || $( '.popup-vimeo' ).length > 0 || $( '.popup-googlemap' ).length > 0 ) ) { 453 454 $( '.popup-youtube, .popup-vimeo, .popup-googlemap' ).magnificPopup({ 455 456 preloader: false, 457 type: 'iframe', 458 mainClass: 'mfp-fade litho-video-popup', 459 removalDelay: 160, 460 fixedContentPos: true, 461 closeBtnInside: false, 462 }); 463 } 464 465 // magnific popup dismiss 466 $( document ).on( 'click', '.popup-modal-dismiss', function (e) { 467 468 e.preventDefault(); 469 $.magnificPopup.close(); 470 }); 471 472 /* Group light box gallery image */ 473 var lightboxgallerygroups = {}; 474 $( '.lightbox-group-gallery-item' ).each(function () { 475 var id = $( this ).attr( 'data-group' ); 476 if ( ! lightboxgallerygroups[id] ) { 477 lightboxgallerygroups[id] = []; 478 } 479 lightboxgallerygroups[id].push( this ); 480 }); 481 482 $.each( lightboxgallerygroups, function () { 483 $( this ).magnificPopup({ 484 type: 'image', 485 closeOnContentClick: true, 486 closeBtnInside: false, 487 fixedContentPos: true, 488 gallery: {enabled: true}, 489 image: { 490 titleSrc: function (item) { 491 var title = ''; 492 var lightbox_caption = ''; 493 if ( item.el.attr( 'title' ) ) { 494 title = item.el.attr( 'title' ); 495 } 496 if ( item.el.attr( 'data-lightbox-caption' ) ) { 497 lightbox_caption += '<span class="litho-lightbox-caption">'; 498 lightbox_caption += item.el.attr( 'data-lightbox-caption' ); 499 lightbox_caption += '</span>'; 500 } 501 return title + lightbox_caption; 502 } 503 } 504 }); 505 }); 506 507 // blog post masonry 508 if ( $( '.blog-post-gallery-type' ).length > 0 || $( '.blog-grid' ).length >
508 0 || $( '.default-portfolio-grid' ).length > 0 ) { 509 $.each( [ '.blog-post-gallery-type', '.blog-grid', '.default-portfolio-grid' ], function( index, item ) { 510 if ( $( item ).length > 0 ) { 511 $( item ).imagesLoaded( function () { 512 $( item ).isotope({ 513 layoutMode: 'masonry', 514 itemSelector: '.grid-item', 515 percentPosition: true, 516 masonry: { 517 columnWidth: '.grid-sizer' 518 } 519 }); 520 $( item ).isotope(); 521 }); 522 } 523 }); 524 } 525 526 // dropdown menu when elementor disabled 527 if ( ! $( 'body' ).hasClass( 'elementor-default' ) ) { 528 529 // Open menu on hover 530 $( document ).on( 'mouseenter touchstart', '.dropdown', function ( e ) { 531 532 var _this = $( this ); 533 _this.addClass( 'open' ); 534 535 if ( _this.hasClass( 'open' ) && getWindowWidth() > tabletBreakPoint ) { 536 _this.find( '.dropdown-menu' ).removeClass( 'show' ); 537 } 538 _this.siblings( '.dropdown' ).removeClass( 'open' ); 539 if ( getWindowWidth() >= tabletBreakPoint ) { 540 if ( $( e.target ).siblings( '.dropdown-menu' ).length ) { 541 e.preventDefault(); 542 } 543 } 544 545 }).on( 'mouseleave', '.dropdown', function() { 546 547 var _this = $( this ); 548 _this.removeClass( 'open' ); 549 }); 550 } 551 552 // Parent menu active in mega menu 553 $( '.header-common-wrapper ul.navbar-nav .megamenu' ).each( function () { 554 var activeMenuLength = $( this ).find( '.megamenu-content .current-menu-item' ).length; 555 if ( activeMenuLength ) { 556 if ( ! $( this ).hasClass( 'current-menu-ancestor' ) ) { 557 $( this ).addClass( 'current-menu-ancestor' ); 558 } 559 } 560 }); 561 562 // close side menu on outside area 563 $( document ).on( 'touchstart click', '.show-menu', function ( e ) { 564 if ( ! ( $( e.target ).hasClass( 'push-button' ) || $( e.target ).closest( '.push-button' ).length || $( e.target ).closest( '.push-menu' ).length || $( e.target ).closest( '.hamburger-menu' ).length || $( e.target ).parents( '.left-menu-modern' ).length || $( e.target ).closest( 'div.elementor-no-template-message' ).length ) ) { 565 $( '.close-menu' ).trigger( 'click' ); 566 } 567 }); 568 569 // hambarger menu open 570 $( document ).on( 'click', '.header-push-button .push-button', function ( event ) { 571 event.preventDefault(); 572 573 if ( $( 'body' ).hasClass( 'show-menu' ) ) { 574 $( 'body' ).removeClass( 'show-menu' ); 575 $( '.sub-menu-item' ).collapse( 'hide' ); 576 $( '.menu-list-item.open' ).removeClass( 'show' ); 577 } else { 578 $( 'body' ).addClass( 'show-menu' ); 579 } 580 } ); 581 582 // side menu submenu toggle 583 $( document ).on( 'click', '.litho-left-menu > li.menu-item-has-children > .menu-toggle', function () { 584 585 $( '.sub-menu-item' ).each( function () { 586 $( this ).collapse( 'hide' ); 587 }); 588 $( '.left-sidebar-wrapper .left-sidebar-nav' ).parents( 'body' ).addClass( 'left-classic-mobile-menu' ); 589 setTimeout( function () { 590 $( '.left-sidebar-wrapper' ).trigger( 'sticky_kit:recalc' ); 591 }, 500 ); 592 }); 593 594 // side menu submenu toggle 595 $( document ).on( 'click', '.sub-menu-item > li.menu-item-has-children > .menu-toggle', function (e) { 596 e.preventDefault(); 597 598 var _parent = $( this ).parent().find( '.sub-menu-item' ); 599 var _parentAttr = $( this ).attr( 'data-bs-target' ); 600 $( this ).parent().parent( '.sub-menu-item' ).find( '.sub-menu-item' ).each( function () { 601 var _this = $( this ), 602 attr = _this.parent().find( '.menu-toggle' ).attr( 'data-bs-target' ); 603 604 if ( attr != _parentAttr ) { 605 _this.parent().find( '.menu-toggle:not(.collapsed)' ).addClass( 'collapsed' ); 606 _this.collapse( 'hide' ); 607 } 608 }); 609 $( '.left-sidebar-wrapper .left-sidebar-nav' ).parents( 'body' ).addClass( 'left-classic-mobile-menu' ); 610 setTimeout( function () { 611 $( '.left-sidebar-wrapper' ).trigger( 'sticky_kit:recalc' ); 612 }, 500); 613 }); 614 615 // hamburger / side menu close 616 var flag = false; 617 $( document ).on( 'click', '.close-menu', function () { 618 if ( ! flag ) { 619 flag = true; 620 setTimeout(function () { 621 flag = false; 622 }, 500 ); 623 624 $( 'body' ).removeClass( 'show-menu left-classic-mobile-menu' );
625 $( '.sub-menu-item' ).collapse( 'hide' ); 626 $( '.menu-item.open' ).removeClass( 'show' ); 627 } 628 } ); 629 630 //Close on escape key 631 $( document ).on( 'keydown', function (e) { 632 if ( e.keyCode === 27 ) { 633 634 // Close side menu 635 $( '.close-menu' ).trigger( 'click' ); 636 637 $( window ).trigger( 'closemenu' ); 638 } 639 }); 640 641 // Return header top space 642 function getTopSpaceHeaderHeight() { 643 644 var mini_header_height = 0, 645 main_header_height = 0, 646 wpadminbarHeight = 0, 647 ts_height = 0; 648 649 if ( $( '.admin-bar #wpadminbar' ).length > 0 ) { 650 651 wpadminbarHeight = $( '.admin-bar #wpadminbar' ).outerHeight(); 652 wpadminbarHeight = Math.round( wpadminbarHeight ); 653 ts_height = ts_height + wpadminbarHeight; 654 } 655 656 if ( $( '.mini-header-main-wrapper' ).length > 0 ) { 657 658 var mini_header_object = $( '.mini-header-main-wrapper' ); 659 mini_header_height = mini_header_object.outerHeight(); 660 ts_height = ts_height + mini_header_height; 661 } 662 663 if ( $( '.header-common-wrapper.standard' ).length > 0 ) { 664 665 var main_header_object = $( '.header-common-wrapper.standard' ); 666 main_header_height = main_header_object.outerHeight(); 667 ts_height = ts_height + main_header_height; 668 } 669 670 return ts_height; 671 } 672 673 // header top space + title space + first section of content 674 setHeaderTopSpace(); 675 function setHeaderTopSpace() { 676 677 var mini_header_height = 0, 678 main_header_height = 0, 679 mini_header_ts_height = 0, 680 main_header_ts_height = 0, 681 wpadminbarHeight = 0, 682 ts_height = 0, 683 ts_full_title_height = 0; 684 685 if ( $( '.mini-header-main-wrapper' ).length > 0 ) { 686 687 var mini_header_object = $( '.mini-header-main-wrapper' ); 688 if ( ! $( 'header' ).hasClass( 'sticky' ) ) { 689 mini_header_height = mini_header_object.outerHeight(); 690 ts_height = ts_height + mini_header_height; 691 } 692 } 693 694 if ( $( '.header-common-wrapper.standard' ).length > 0 ) { 695 696 var main_header_object = $( '.header-common-wrapper.standard' ); 697 main_header_height = main_header_object.outerHeight(); 698 main_header_object.css( 'margin-top', ts_height ); 699 ts_height = ts_height + main_header_height; 700 } 701 702 // for Left Menu Classic mobile menu 703 if ( $( '.header-common-wrapper.left-menu-classic' ).length > 0 ) { 704 705 var main_header_object = $( '.header-common-wrapper.left-menu-classic' ).find( '.elementor-section-wrap section' ).first(); 706 main_header_height = main_header_object.outerHeight(); 707 ts_height = ts_height + main_header_height; 708 } 709 710 // for page content first section ( elementor ) 711 var pageContent = $( '.litho-main-content-wrap' ).find( '.entry-content-inner' ), 712 sectionFirst = pageContent.find( '.elementor-section-wrap section' ).first(); 713 714 // for page title first section 715 var pageTitle = $( '.litho-main-title-wrappper' ), 716 pageTitlesection = pageTitle.find( '.elementor-section-wrap section' ).first(); 717 718 if ( $( '.litho-main-title-wrappper' ).length > 0 && pageTitlesection.hasClass( 'top-space' ) || $( '.default-main-title-wrappper' ).length > 0 ) { 719 720 var padding_top = $( '.litho-main-title-wrappper' ).attr( 'data-padding-top' ); 721 722 if ( padding_top == '' || padding_top == undefined ) { 723 724 padding_top = $( '.litho-main-title-wrappper' ).css( 'padding-top' ); 725 726 $( '.litho-main-title-wrappper' ).attr( 'data-padding-top', padding_top ); 727 } 728 729 ts_height = parseInt( ts_height ) + parseInt( padding_top ); 730 731 $( '.litho-main-title-wrappper .top-space' ).css( 'padding-top', ts_height + 'px' ); 732 733 } else if ( $( '.litho-main-inner-content-wrap' ).hasClass( 'top-space' ) && $( '.litho-main-title-wrappper' ).length === 0 ) { 734 735 // single post 736 $( '.litho-main-inner-content-wrap.top-space' ).parents( '.litho-main-content-wrap' ).css( 'margin-top', ts_height + 'px' ); 737 738 } else if ( ( sectionFirst.hasClass( 'top-space' ) || $( '.error-404' ).hasClass( 'top-space' ) ) && $( '.litho-main-title-wrappper' ).length === 0 ) { 739 // First section of page content header top space 740 $( '.litho-main-content-wrap .top-space, .error-404.top-space' ).parents( '.litho-main-content-wrap' ).css( 'margin-top', ts_height + 'px' ); 741 742 } else { 743 744 // For Mobile Menu Top Space 745 if ( getWindowWidth() <= tabletBreakPoint ) { 746 747 $( 'header nav' ).addClass( 'mobile-top-space' ); 748 749 if ( $( 'header nav' ).hasClass( 'mobile-top-space' ) ) { 750 $( 'body' ).css( 'padding-top', ts_height + 'px' ); 751 } 752 753 } else { 754 755 $( 'header nav' ).removeClass( 'mobile-top-space' ); 756 $( 'body' ).css( 'padding-top', '' ); 757 if ( ( ! $( 'header nav' ).hasClass( 'no-sticky' ) && $( 'header nav' ).hasClass( 'mobile-top-space' ) ) || $('.left-menu-classic').hasClass('mobile-top-space') ) { 758 $( 'body' ).css( 'padding-top', ts_height + 'px' ); 759 } else { 760 $( 'body' ).css( 'padding-top', '' ); 761 } 762 } 763 } 764 765 // FULLSCREEN min-height 766 if ( $( '.full-screen' ).length > 0 ) { 767 768 if ( $( '.admin-bar #wpadminbar' ).length > 0 ) { 769 770 wpadminbarHeight = $( '.admin-bar #wpadminbar' ).outerHeight(); 771 wpadminbarHeight = Math.round( wpadminbarHeight ); 772 } 773 774 $( '.full-screen' ).each( function() { 775 var _self = $( this ); 776 777 _self.parents( '.elementor-top-section' ).imagesLoaded( function () { 778 779 var minheight = getWindowHeight(); 780 if ( _self.parents( '.elementor-top-section' ).hasClass( 'top-space' ) ) { 781 782 minheight = minheight - ts_height; 783 _self.css( 'min-height', ( minheight - wpadminbarHeight ) ); 784 785 } else { 786 787 if ( getWindowWidth() <= tabletBreakPoint ) { 788 789 var fulltotalHeight = wpadminbarHeight + ts_height; 790 791 _self.css( 'min-height', minheight - fulltotalHeight ); 792 793 } else { 794 795 _self.css( 'min-height', ( minheight - wpadminbarHeight ) ); 796 } 797 } 798 799 });
800 }); 801 } 802 803 // FULLSCREEN Height 804 if ( $( '.full-screen-height' ).length > 0 ) { 805 806 if ( $( '.admin-bar #wpadminbar' ).length > 0 ) { 807 808 wpadminbarHeight = $( '.admin-bar #wpadminbar' ).outerHeight(); 809 wpadminbarHeight = Math.round( wpadminbarHeight ); 810 } 811 812 $( '.full-screen-height' ).each( function() { 813 var _self = $( this ); 814 var _height = getWindowHeight(); 815 816 setTimeout( function () { 817 if ( getWindowWidth() <= tabletBreakPoint ) { 818 var fulltotalHeight = wpadminbarHeight + ts_height; 819 _self.css( 'height', ( _height - fulltotalHeight ) ); 820 } else { 821 _self.css( 'height', ( _height - wpadminbarHeight ) ); 822 } 823 }, 500 ); 824 }); 825 } 826 } 827 828 // sticky left menu 829 stickyElement(); 830 function stickyElement() { 831 if ( getWindowWidth() >= tabletBreakPoint ) { 832 if ( $( '.left-sidebar-wrapper .header-left-wrapper' ).length > 0 ) { 833 $( '.left-sidebar-wrapper .header-left-wrapper' ).stick_in_parent( { 834 recalc: 1 835 } ); 836 } 837 } 838 } 839 840 // Sticky footer 841 stickyFooter(); 842 function stickyFooter() { 843 if ( $( '.footer-sticky' ).length > 0 ) { 844 $( '.footer-sticky' ).imagesLoaded( function () { 845 var footerHeight = $( '.footer-sticky' ).outerHeight(); 846 $( '.litho-main-content-wrap' ).css({ 'margin-bottom': footerHeight }); 847 }); 848 } 849 if ( $( '.box-layout' ).length > 0 && $( '.footer-sticky' ).length > 0 ) { 850 var boxLayoutObj = $( '.box-layout' ), 851 boxLayoutwidth = boxLayoutObj.width(); 852 boxLayoutObj.find( '.footer-sticky' ).css({ 'margin': '0 auto', 'width': boxLayoutwidth, 'max-width': boxLayoutwidth }); 853 } 854 } 855 856 // For mobile left menu classic 857 if ( $( '.header-common-wrapper' ).hasClass( 'left-menu-classic' ) ) { 858 var $leftMenu = $( '.left-menu-classic' ).find( '.elementor-widget-litho-left-menu' ); 859 if ( $leftMenu.length > 0 ) { 860 $leftMenu.parents( '.elementor-top-section' ).addClass( 'left-menu-classic-section' ); 861 } 862 } 863 864 var $navbarWidgetNavbar = $( '.header-common-wrapper.standard .elementor-widget-litho-mega-menu .navbar-collapse' ); 865 var $navbarWidgetNavbarToggle = $( '.header-common-wrapper.standard .elementor-widget-litho-mega-menu .navbar-toggler' ); 866 var mobileNavStyle = $( 'body' ).attr( 'data-mobile-nav-style' ); 867 868 // mobile navigation modern/full-screen style 869 mobileModernFullscreenNavigation(); 870 function mobileModernFullscreenNavigation() { 871 872 var layout_class = ''; 873 if ( $( '.box-layout' ).length > 0 ) { 874 layout_class = '.box-layout'; 875 } else { 876 layout_class = '.page-layout'; 877 } 878 879 if ( getWindowWidth() <= tabletBreakPoint ) { 880 881 if ( ( mobileNavStyle == 'modern' || mobileNavStyle == 'full-screen-menu' ) && $navbarWidgetNavbar.length > 1 && ! $( '.navbar-nav-clone' ).length ) { 882 883 $navbarWidgetNavbar.first().find( '.navbar-nav' ).clone( false ).addClass( 'navbar-nav-clone' ).insertBefore( $navbarWidgetNavbar.last().find( '.navbar-nav' ) ); 884 $navbarWidgetNavbar.last().addClass( 'navbar-collapse-final' ); 885 $navbarWidgetNavbarToggle.last().addClass( 'navbar-toggler-final' ); 886 } 887 888 } else { 889 890 if ( ( mobileNavStyle == 'modern' || mobileNavStyle == 'full-screen-menu' ) && $navbarWidgetNavbar.length > 1 && $( '.navbar-nav-clone' ).length > 0 ) { 891 $navbarWidgetNavbar.last().removeClass( 'navbar-collapse-final' ); 892 $navbarWidgetNavbarToggle.last().removeClass( 'navbar-toggler-final' ); 893 $navbarWidgetNavbar.last().find( '.navbar-nav-clone' ).remove(); 894 } 895 } 896 897 if ( getWindowWidth() <= tabletBreakPoint ) { 898 899 if ( ( mobileNavStyle == 'modern' || mobileNavStyle == 'full-screen-menu' ) && ! $( '.navbar-' + mobileNavStyle + '-inner' ).length ) { 900 901 if ( $navbarWidgetNavbar.length > 1 ) { 902 903 var targetButtonClone = $( '.header-common-wrapper.standard .navbar-toggler-final' ).clone( false ).addClass( 'navbar-toggler-clone' ).insertAfter( layout_class ), 904 targetNavClone = $( '.header-common-wrapper.standard .navbar-collapse-final' ).clone( false ).addClass( 'navbar-collapse-clone' ).attr( 'id', 'navbarNav-clone' ).insertAfter( layout_class ); 905 906 var mobileNavInnerHTML = ''; 907 mobileNavInnerHTML += '<div class="navbar-'; 908 mobileNavInnerHTML += mobileNavStyle; 909 mobileNavInnerHTML += '-inner"></div>'; 910 $( '.navbar-toggler-clone, .navbar-collapse-clone' ).wrapAll( mobileNavInnerHTML ); 911 $( '.navbar-toggler' ).attr( 'data-bs-target', '#navbarNav-clone' ).attr( 'aria-controls', '#navbarNav-clone' ); 912 913 } else { 914 915 var targetButtonClone = $( '.header-common-wrapper.standard .navbar-toggler' ).clone( false ).addClass( 'navbar-toggler-clone' ).insertAfter( layout_class ), 916 targetNavClone = $( '.header-common-wrapper.standard .navbar-collapse' ).clone( false ).addClass( 'navbar-collapse-clone' ).attr( 'id', 'navbarNav-clone' ).insertAfter( layout_class ); 917 918 var mobileNavInnerHTML = ''; 919 mobileNavInnerHTML += '<div class="navbar-'; 920 mobileNavInnerHTML += mobileNavStyle; 921 mobileNavInnerHTML += '-inner"></div>'; 922 $( '.navbar-toggler-clone, .navbar-collapse-clone' ).wrapAll( mobileNavInnerHTML ); 923 $( '.navbar-toggler' ).attr( 'data-bs-target', '#navbarNav-clone' ).attr( 'aria-controls', '#navbarNav-clone' ); 924 } 925 926 $( '.navbar-' + mobileNavStyle + '-inner' ).find( '.dropdown-toggle' ).addClass( 'dropdown-toggle-clone' ); 927 928 if ( $( '.navbar-collapse-clone' ).length > 0 ) { 929 $( '.navbar-collapse-clone' ).mCustomScrollbar(); 930 } 931
932 if ( mobileNavStyle == 'modern' && ! $( '.navbar-show-modern-bg' ).length ) { 933 $( '<div class="navbar-show-modern-bg"></div>' ).insertAfter( layout_class ); 934 } 935 } 936 } 937 } 938 939 // hide collaps on outside click 940 $( document ).on( 'touchstart click', 'body', function ( e ) { 941 942 if ( ! $( e.target ).parents( 'nav' ).hasClass( 'standard' ) && getWindowWidth() >= tabletBreakPoint ) { 943 if ( $( '.dropdown' ).length > 0 ) { 944 $( '.dropdown' ).each( function () { 945 if ( $( this ).hasClass( 'open' ) ) { 946 $( this ).removeClass( 'open show' ); 947 } 948 }); 949 } 950 } 951 952 if ( ! $( '.navbar-collapse' ).has( e.target ).is( '.navbar-collapse' ) && 953 $( '.navbar-collapse' ).hasClass( 'show' ) && 954 ! $( e.target ).hasClass( 'navbar-toggle' ) && 955 ! $( e.target ).hasClass( 'navbar-collapse-clone' ) ) { 956 957 $( '.navbar-collapse' ).collapse( 'hide' ); 958 } 959 960 if ( ! $( e.target ).closest( '.theme-demos' ).length && $( '.theme-demos' ).hasClass( 'show' ) ) { 961 $( '.theme-demos' ).removeClass( 'show' ); 962 963 if ( $( 'body' ).hasClass('overflow-hidden') ) { 964 $( 'body' ).removeClass('overflow-hidden'); 965 } 966 } 967 }); 968 969 // navbar toggle 970 var flag = false; 971 $( document ).on( 'click', '.navbar-toggle', function ( e ) { 972 if ( getWindowWidth() >= tabletBreakPoint ) { 973 if ( ! flag ) { 974 flag = true; 975 setTimeout(function () { 976 flag = false; 977 }, 500); 978 $( 'body' ).addClass( 'show-menu' ); 979 } else { 980 if ( ! $( '.navbar-collapse' ).has( e.target ).is( '.navbar-collapse' ) && $( '.navbar-collapse ul' ).hasClass( 'show' ) ) { 981 $( '.navbar-collapse' ).find( 'a.dropdown-toggle' ).addClass( 'collapsed' ); 982 $( '.navbar-collapse' ).find( 'ul.dropdown-menu' ).removeClass( 'show' ); 983 $( '.navbar-collapse a.dropdown-toggle' ).removeClass( 'active' ); 984 } 985 } 986 } 987 }); 988 989 // Bootstrap dropdown toggle 990 navbarDropdown(); 991 function navbarDropdown() { 992 if ( $( '.navbar-modern-inner' ).length > 0 ) { 993 994 if ( $( '.dropdown-toggle-clone' ).length > 0 && $.isFunction( window.dropdown ) ) { 995 $( '.dropdown-toggle-clone' ).dropdown(); 996 } 997 998 } else { 999 if ( $( '.dropdown-toggle' ).length > 0 && $.isFunction( window.dropdown ) ) { 1000 $( '.dropdown-toggle' ).dropdown(); 1001 } 1002 } 1003 } 1004 1005 // Navbar collapse modern & full screen menu event 1006 navbarCollapseToggle(); 1007 function navbarCollapseToggle() { 1008 $( '.navbar-collapse-clone.collapse' ).on( 'show.bs.collapse', function () { 1009 1010 if ( ! $( 'body' ).hasClass( 'navbar-collapse-show' ) ) { 1011 $( 'body' ).addClass( 'navbar-collapse-show' ); 1012 if ( $( 'body' ).attr( 'data-mobile-nav-bg-color' ) && $( '.navbar-modern-inner' ).length > 0 ) { 1013 var bgColor = $( 'body' ).attr( 'data-mobile-nav-bg-color' ); 1014 $( '.navbar-show-modern-bg' ).css( 'background', bgColor ); 1015 } 1016 if ( $( 'body' ).attr( 'data-mobile-nav-bg-color' ) && $( '.navbar-full-screen-menu-inner' ).length > 0 ) { 1017 var bgColor = $( 'body' ).attr( 'data-mobile-nav-bg-color' ); 1018 $( '.navbar-full-screen-menu-inner' ).css( 'background', bgColor ); 1019 } 1020 } 1021 1022 var windowHeight = getWindowHeight(); 1023 if ( $( '.navbar-modern-inner' ).length > 0 || $( '.navbar-full-screen-menu-inner' ).length > 0 ) { 1024 $( this ).css( 'max-height', windowHeight ); 1025 } else { 1026 $( this ).css( 'max-height', ( windowHeight - getTopSpaceHeaderHeight() ) ); 1027 } 1028 1029 }).on( 'hide.bs.collapse', function () { 1030 if ( $( 'body' ).hasClass( 'navbar-collapse-show' ) ) { 1031 $( 'body' ).removeClass( 'navbar-collapse-show' ); 1032 } 1033 }); 1034 } 1035 1036 // START window scroll event 1037 var pageScroll = 0; 1038 $( window ).on( 'scroll', function() { 1039 var scrollTop = $( this ).scrollTop(); 1040 if ( pageScroll > 0 || scrollTop > pageScroll ) { 1041 headerWrapper( scrollTop ); 1042 } 1043 pageScroll++; 1044 1045 /****** One page navigation ******/ 1046 var menuLinks = $( '.navbar-nav li a' ); 1047 if ( menuLinks.length > 0 ) { 1048 menuLinks.each( function () { 1049 var _this = $( this ); 1050 var hasPos = _this.attr( 'href' ).indexOf( '#' ); 1051 if ( hasPos > -1 ) { 1052 var res = _this.attr( 'href' ).substring( hasPos ); 1053 if ( res != '' && res != '#' && $( res ).length > 0 ) { 1054 var refElement = $( _this.attr( 'href' ) ); 1055 if ( refElement.position().top <= ( scrollTop + 60 ) && refElement.position().top + refElement.height() > ( scrollTop + 60 ) ) { 1056 menuLinks.removeClass( 'active' ); 1057 _this.addClass( 'active' ); 1058 } 1059 if ( scrollTop < 0 ) { 1060 _this.removeClass( 'active' ); 1061 } 1062 } 1063 } 1064 }); 1065 } 1066 1067 } ); 1068 // END window scroll event 1069 1070 // START window resize event 1071 $( window ).on( 'resize', function() { 1072 1073 //megaMenuOnResize(); 1074 stickyElement(); 1075 stickyFooter(); 1076 1077 //mobileClassicNavigation(); 1078 mobileModernFullscreenNavigation();
1079 navbarCollapseToggle(); 1080 // Bootstrap dropdown toggle 1081 navbarDropdown(); 1082 1083 setTimeout( function () { 1084 setHeaderTopSpace(); 1085 }, 400 ); 1086 1087 if ( ! $( 'body' ).hasClass( 'elementor-editor-active' ) ) { 1088 1089 setTimeout(function () { 1090 1091 if ( $( '.blog-grid' ).length > 0 ) { 1092 1093 $( '.blog-grid' ).imagesLoaded( function() { 1094 $( '.blog-grid' ).isotope( 'layout' ); 1095 }); 1096 } 1097 if ( $( '.blog-post-gallery-type' ).length > 0 ) { 1098 1099 $( '.blog-post-gallery-type' ).imagesLoaded( function() { 1100 $( '.blog-post-gallery-type' ).isotope( 'layout' ); 1101 }); 1102 } 1103 if ( $( '.default-portfolio-grid' ).length > 0 ) { 1104 1105 $( '.default-portfolio-grid' ).imagesLoaded( function() { 1106 $( '.default-portfolio-grid' ).isotope( 'layout' ); 1107 }); 1108 } 1109 1110 }, 500 ); 1111 } 1112 }); 1113 // END window resize event 1114 1115 // Window orientationchange 1116 $( window ).on( 'orientationchange', function( e ) { 1117 1118 // Close side menu 1119 $( '.close-menu' ).trigger( 'click' ); 1120 1121 $( window ).trigger( 'closemenu' ); 1122 }); 1123 1124 $( window ).on( 'closemenu', function( e ) { 1125 // Close all dropdown 1126 $( '.dropdown' ).each( function () { 1127 var _this = $( this ); 1128 _this.trigger( 'mouseleave' ); 1129 _this.removeClass( 'show' ); 1130 _this.children( '.dropdown-menu' ).removeClass( 'show' ); 1131 }); 1132 1133 // Close all menu 1134 if ( $( '.navbar-collapse' ).hasClass( 'show' ) ) { 1135 $( '.navbar-collapse' ).collapse( 'hide' ); 1136 $( '.navbar-collapse' ).removeClass( 'show' ); 1137 } 1138 if ( $( 'body' ).hasClass( 'navbar-collapse-show' ) ) { 1139 $( 'body' ).removeClass( 'navbar-collapse-show' ); 1140 } 1141 setTimeout( function () { 1142 if ( $( 'body' ).hasClass( 'navbar-collapse-show-after' ) ) { 1143 $( 'body' ).removeClass( 'navbar-collapse-show-after' ); 1144 } 1145 }, 500 ); 1146 1147 setTimeout( function () { 1148 $( '.navbar-collapse' ).css( 'left', '' ); 1149 }, 400 ); 1150 }); 1151 1152 $( document ).on( 'click', '.scroll-top-arrow', function () { 1153 $( 'html, body' ).animate({ scrollTop: 0 }, 800 ); 1154 return false; 1155 }); 1156 1157 } ); // End document ready 1158 1159})( 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.