1(function ($) { 2 'use strict'; 3 4 /* Table of contents */ 5 /* 6 # Headers 7 # Bar 8 # Navigation 9 # Footer 10 # Shortcodes 11 ## Accordion box 12 ## Banner box 13 ## Counter box 14 ## Contact form 15 ## Countdown box 16 ## Cover box 17 ## Gallery 18 ## Parallax 19 ## Progress bar 20 ## Pricing table 21 ## Social Bar 22 ## Split Box 23 ## Sliders 24 ## Tabs 25 ## Video Background 26 ## Scroll content 27 # Shop 28 ## Shop products filter 29 ## Shop Masonry 30 #Product 31 ## Ajax cart 32 # Lazy load 33 # Other 34 */ 35 36 window.Clb = { 37 init: function () { 38 // Header 39 this.header = $('#masthead'); 40 this.body = $('body'); 41 this.headerIsFifth = Clb.header.hasClass('header-4'); 42 this.headerIsSixth = Clb.header.hasClass('header-5'); 43 this.wpadminbar = $('#wpadminbar'); 44 45 this.headerFixed = { 46 initialOffset: parseInt(this.header.attr('data-fixed-initial-offset')) || 150, 47 48 enabled: $('[data-header-fixed]').length, 49 value: false, 50 51 mobileEnabled: $('[data-mobile-header-fixed]').length, 52 mobileValue: false 53 }; 54 55 this.searchPopup = $('.clb-search-popup'); 56 this.subheader = $('.subheader'); 57 58 // Logos 59 this.siteBranding = this.header.find('.branding'); 60 this.siteTitle = this.header.find('.branding-title'); 61 this.logo = this.header.find('.logo'); 62 this.fixedLogo = this.header.find('.fixed-logo'); 63 this.mobileLogo = this.header.find('.mobile-logo'); 64 this.fixedMobileLogo = this.header.find('.fixed-mobile-logo'); 65 66 this.logoForOnepage = this.header.find('.for-onepage'); 67 this.logoForOnepageDark = this.logoForOnepage.find('.dark'); 68 this.logoForOnepageLight = this.logoForOnepage.find('.light'); 69 70 // Menus 71 this.megaMenu = this.header.find('#mega-menu-wrap'); 72 this.mobileMenu = $('[data-mobile-menu-resolution]').data('mobile-menu-resolution'); 73 74 // Page 75 this.containerLoading = $('.container-loading'); 76 77 this.shopProductsType = $('.woo-shop-container'); 78 79 //RTL 80 this.isRtl = $('body').hasClass('rtl'); 81 82 //Elementor 83 this.isElementorPage = $('body').hasClass('elementor-page'); 84 85 this.resize(); 86 }, 87 88 resize: function () { 89 this.isMobile = $(window).width() <= 768; 90 this.isPad = $(window).width() <= 1024; 91 this.isMobileMenu = $(window).width() <= Clb.mobileMenu 92 } 93 }; 94 95 function setCookie(cname, cvalue, exdays) { 96 var d = new Date(); 97 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 98 var expires = "expires=" + d.toUTCString(); 99 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 100 } 101 102 function getCookie(name) { 103 var matches = document.cookie.match(new RegExp( 104 "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" 105 )); 106 return matches ? decodeURIComponent(matches[1]) : undefined; 107 } 108 109 /* # Headers */ 110 function handleHeaders() { 111 112 // // Search open 113 // $('[data-nav-search]').on("click", function (e) { 114 // e.preventDefault(); 115 // $('.search_results').empty(); 116 // Clb.searchPopup.addClass('visible'); 117 // }); 118 119 // // Search close 120 // Clb.searchPopup.find('.close').on("click", function (e) { 121 // Clb.searchPopup.removeClass('visible'); 122 // $('.search_results').empty(); 123 // }); 124 125 // $(document).on('keydown', function (e) { 126 // if (e.keyCode == 27) { 127 // Clb.searchPopup.removeClass('visible'); 128 // $('.search_results').empty(); 129 // } 130 // }); 131 $('[data-nav-search]').on("click", function (e) { 132 e.preventDefault(); 133 handlePopup('.clb-search-popup'); 134 $('.search_results').empty(); 135 }); 136 137 138 // Remove close from form 139 Clb.searchPopup.find('form').on("click", function (e) { 140 e.stopPropagation(); 141 }); 142 143 handleMobileHeader(); 144 handleHeaderSize(); 145 handleFixedHeader(); 146 } 147 148 function handleMobileHeader() { 149 if (!Clb.header || !Clb.header.length) { 150 return; 151 } 152 153 if (Clb.isMobileMenu) { 154 Clb.header.addClass('-mobile'); 155 Clb.body.addClass('is-mobile-menu'); 156 setTimeout(function () { 157 $('.nav').addClass('unhidden'); 158 }, 300); 159 } else { 160 Clb.header.removeClass('-mobile'); 161 Clb.body.removeClass('is-mobile-menu'); 162 $('.nav').addClass('visible'); 163 } 164 } 165 166 function handleHeaderSize() { 167 168 handleFixedHeader(); 169 170 // Reset mega menu css properties for mobile phone 171 if (Clb.isMobileMenu) { 172 Clb.megaMenu.find('ul').css({ 173 'left': '', 174 'width': '', 175 'max-width': '', 176 'min-width': '' 177 }); 178 } 179 } 180 181 function handleFixedHeader() { 182 183 if (!Clb.headerFixed) { 184 return; 185 } 186 187 var fixed = Clb.headerFixed; 188 189 if ($(document).scrollTop() > fixed.initialOffset) { 190 191 if ((!Clb.isMobileMenu && fixed.enabled && !fixed.value) || 192 (Clb.isMobileMenu && fixed.mobileEnabled && !fixed.mobileValue)) { 193 194 if (Clb.isMobileMenu) { 195 fixed.mobileValue = true; 196 } else { 197 fixed.value = true; 198 } 199 200 Clb.header.addClass('-sticky') 201 202 // Hide non fixed logos 203 Clb.logo.css('display', 'none'); 204 Clb.mobileLogo.css('display', 'none'); 205 Clb.logoForOnepage.css('display', 'none'); 206 207 // Show fixed logo
208 if (Clb.isMobileMenu && Clb.fixedMobileLogo.length) { 209 Clb.fixedMobileLogo.css('display', 'flex'); 210 } else { 211 Clb.fixedLogo.css('display', 'flex'); 212 } 213 } 214 215 } else if (fixed.value || fixed.mobileValue) { 216 217 fixed.value = false; 218 fixed.mobileValue = false; 219 220 Clb.header.removeClass('-sticky'); 221 222 // Hide fixed logos 223 Clb.fixedLogo.css('display', ''); 224 Clb.fixedMobileLogo.css('display', ''); 225 226 // Show non fixed logo 227 if (Clb.isMobileMenu && Clb.mobileLogo.length) { 228 Clb.logo.css('display', 'none'); 229 Clb.logoForOnepage.css('display', 'none'); 230 Clb.mobileLogo.css('display', 'flex'); 231 } else { 232 Clb.logo.css('display', 'flex'); 233 Clb.logoForOnepage.css('display', ''); 234 Clb.mobileLogo.css('display', 'none'); 235 } 236 237 } 238 239 // Effect appearance 240 if ($(document).scrollTop() > fixed.initialOffset + 50) { 241 Clb.header.addClass('showed'); 242 } else { 243 Clb.header.removeClass('showed'); 244 } 245 } 246 247 function handleHeaderTitle() { 248 // Ttitle Parallax 249 if ($('.clb-page-headline .page-title').hasClass('no-transition')) { 250 if ($('.clb-page-headline h1').length) { 251 var scroll = $(document).scrollTop() / 3; 252 if (scroll > 200) { 253 scroll = 200; 254 } else { 255 scroll = scroll; 256 } 257 $('.clb-page-headline h1, .clb-page-headline p.subtitle, .clb-page-headline .tags').css({ 258 'transform': 'translate3d(0,' + (scroll) + 'px, 0)', 259 'opacity': 1 - (scroll / 200) 260 }); 261 } 262 } 263 } 264 265 /* # Bar */ 266 267 function handleBarScroll() { 268 var bar = $('.bar'); 269 270 if (bar.length) { 271 var hamburger = $('.bar-hamburger .hamburger'); 272 273 if ($(document).scrollTop() > 100) { 274 hamburger.css('margin-top', '25px'); 275 } else { 276 hamburger.css('margin-top', ''); 277 } 278 } 279 } 280 281 /* # Navigation */ 282 283 window.openFullscreenMenu = function () { 284 $('.hamburger-nav').addClass('visible').find('.menu > li').each(function (i) { 285 var link = $(this); 286 setTimeout(function () { 287 link.addClass('showed'); 288 }, 150 + i * 40); 289 }); 290 }; 291 292 function mobileSubMenuCalcHeight() { 293 setTimeout(function () { 294 $('.sub-menu, .sub-sub-menu').each(function () { 295 296 var subMenuItems = $(this).find('> .mega-menu-item'); 297 var subMenuHeight = 0; 298 299 subMenuItems.each(function () { 300 subMenuHeight += $(this).outerHeight(); 301 }); 302 303 $(this).attr('data-sub-menu-height', subMenuHeight) 304 }); 305 }, 300); 306 } 307 308 function handleNavigations() { 309 310 // Mobile menu 311 var menuNow = 0; 312 var doubleClickLink = Boolean($('.nav').attr('data-mobile-menu-second-click-link')); 313 314 $('.hamburger').on("click", function () { 315 handlePopup('.nav .mbl-overlay'); 316 }); 317 318 $('.clb-close, .mbl-overlay-bg, .-mobile #site-navigation a').on("click", function () { 319 320 $('#mega-menu-sub-' + menuNow).removeClass('active'); 321 $('#mega-menu-sub-' + menuNow).removeAttr('id'); 322 menuNow--; 323 $('#site-navigation').removeClass('active'); 324 $('.close-menu').css('right', '-100%'); 325 $('.hamburger').removeClass('hidden'); 326 $('#masthead .search').removeClass('visible'); 327 328 if (Clb.isMobileMenu || Clb.isPad) { 329 closePopup($('.nav .mbl-overlay')); 330 } 331 }); 332 333 if (Clb.isPad) { 334 $(document).on('keydown', function (e) { 335 if (e.keyCode == 27) { 336 closePopup($('.nav .mbl-overlay')); 337 } 338 }); 339 340 mobileSubMenuCalcHeight() 341 } else { 342 $(document).on('click', function (event) {
343 if (!$(event.target).hasClass('sub-menu-wide') && !$(event.target).parents('.nav-item').find('.sub-menu-wide').length) { 344 $('.sub-menu-wide').parent().removeClass('active'); 345 } 346 }); 347 } 348 349 350 $('a.menu-link').on('click', function () { 351 if ($(this).attr('href').includes('#')) { 352 353 menuNow = 0; 354 $('[id^="mega-menu-sub-"]').removeClass('active'); 355 $('[id^="mega-menu-sub-"]').removeAttr('id'); 356 $('#site-navigation').removeClass('active'); 357 $('.close-menu').css('right', '-100%'); 358 $('.hamburger').removeClass('hidden'); 359 $('#masthead .search').removeClass('visible'); 360 closePopup($('.clb-popup.hamburger-nav')); 361 closePopup($('.header .mbl-overlay.menu-mbl-overlay.visible')); 362 } 363 }); 364 365 $('.has-submenu > a').off().on('click touchend', function (e) { 366 if (Clb.isPad) { 367 368 e.preventDefault(); 369 370 var mainSubMenu = $(this).parents('.sub-menu'); 371 var parent = $(this).parent(); 372 373 if (parent.hasClass('active')) { 374 375 if (doubleClickLink) { 376 window.location.href = $(this).attr('href'); 377 return; 378 } 379 380 //Reset active and height for inner items 381 parent.removeClass('active'); 382 383 var subMenu = parent.find('.sub-menu, .sub-sub-menu'); 384 385 386 if (subMenu.hasClass('sub-menu')) { 387 if (Clb.isMobileMenu) { 388 subMenu.css('height', 0); 389 } 390 391 parent.find('active').removeClass('active'); 392 } else { 393 var subMenuHeight = subMenu.data('sub-menu-height'); 394 395 if (Clb.isMobileMenu) { 396 subMenu.css('height', 0); 397 } 398 399 if ($(this).parents('.sub-menu, .sub-sub-menu').length && Clb.isMobileMenu) { 400 401 $(this).parents('.sub-menu, .sub-sub-menu').each(function () { 402 403 subMenuHeight += $(this).data('sub-menu-height'); 404 405 var subSubMenuHeight = 0; 406 $(this).find('.active > .sub-sub-menu').each(function () { 407 subSubMenuHeight += $(this).data('sub-menu-height') 408 }); 409 410 $(this).css('height', $(this).data('sub-menu-height') + subSubMenuHeight) 411 }); 412 } 413 414 if (Clb.isMobileMenu) { 415 mainSubMenu.css('height', mainSubMenu - subMenuHeight); 416 } 417 } 418 } else { 419 var subMenu = parent.find('> .sub-menu, > .sub-sub-menu'); 420 421 //Reset active and height 422 parent.siblings().removeClass('active'); 423 parent.siblings().find('.mega-menu-item').removeClass('active'); 424 425 if (Clb.isMobileMenu) { 426 if (subMenu.hasClass('sub-menu')) { 427 parent.siblings().find('.sub-menu, .sub-sub-menu').css('height', '0'); 428 } else { 429 parent.siblings().find('.sub-menu, .sub-sub-menu').css('height', '0'); 430 mainSubMenu.css('height', subMenu.data('sub-menu-height')); 431 } 432 } 433 434 parent.addClass('active'); 435 436 //Add active and calculate height 437 if (Clb.isMobileMenu) { 438 if (subMenu.hasClass('sub-menu')) { 439 subMenu.css('height', subMenu.data('sub-menu-height')); 440 } else { 441 var subMenuHeight = subMenu.data('sub-menu
441-height'); 442 443 subMenu.css('height', subMenu.data('sub-menu-height')); 444 445 446 if ($(this).parents('.sub-menu, .sub-sub-menu').length) { 447 448 $(this).parents('.sub-menu, .sub-sub-menu').each(function () { 449 450 subMenuHeight += $(this).data('sub-menu-height'); 451 452 var subSubMenuHeight = 0; 453 $(this).find('.active > .sub-sub-menu').each(function () { 454 subSubMenuHeight += $(this).data('sub-menu-height') 455 }); 456 457 $(this).css('height', $(this).data('sub-menu-height') + subSubMenuHeight) 458 }); 459 } 460 461 mainSubMenu.css('height', subMenuHeight); 462 } 463 } 464 465 } 466 } else { 467 window.location.href = $(this).attr('href'); 468 469 if ($(this).attr('href').includes('#')) { 470 471 if ($(this).parent().hasClass('active')) { 472 $(this).parent().removeClass('active'); 473 } else { 474 $(this).parent().addClass('active'); 475 } 476 } 477 } 478 }); 479 480 if ($('#masthead nav > .mobile-wpml-select').length) { 481 $('#masthead nav > .mobile-wpml-select').insertAfter($('#mega-menu-wrap > ul > li').last()); 482 } 483 484 /* # Cart */ 485 486 $("a.cart .icon").on("click", function (e) { 487 e.preventDefault(); 488 $(".submenu_cart").toggleClass("visible"); 489 }); 490 $("#close_cart").on("click", function () { 491 $(".submenu_cart").removeClass("visible"); 492 }); 493 494 $('#mega-menu-wrap .sub-sub-menu').each(function () { 495 if ($(this).offset().left + $(this).outerWidth() > $(window).width()) { 496 $(this).addClass('menu-left'); 497 498 var menuPosition = $(this).outerWidth(); 499 $(this).css('left', - menuPosition); 500 } 501 }); 502 503 /* # Fullscreen hamburger menu */ 504 505 $('.hamburger').on('click', function (e) { 506 e.preventDefault(); 507 openFullscreenMenu(); 508 }); 509 510 var closeMenu = function () { 511 $('.hamburger-nav').removeClass('visible').find('.menu > li').each(function (i) { 512 $(this).removeClass('showed active'); 513 }); 514 }; 515 516 $(".close").on("click", function () { 517 closeMenu(); 518 }); 519 520 $('.sub-menu-wide').parent().mouseover(function () { 521 wideMenuOnLoadPosition(); 522 }); 523 524 var fullscreenMenu = $('.hamburger-nav-holder'); 525 526 if (fullscreenMenu.length) { 527 528 var isCentered = fullscreenMenu.parents('.hamburger-nav').hasClass('type2') || fullscreenMenu.parents('.hamburger-nav').hasClass('type3'); 529 var menuNow = 0; 530 531 if (isCentered) { 532 var megaMenuItem = fullscreenMenu.find('.mega-menu-item'); 533 534 megaMenuItem.each(function () { 535 var self = $(this).find('> a'); 536 self.find('> span').clone().addClass('cloned').appendTo(self); 537 538 self.find('.has-submenu-icon').addClass("btn-round btn-round-small "); 539 }); 540 541 var menuIcon = $('.has-submenu > a .has-submenu-icon'); 542 543 menuIcon.off().on('click touchend', function (e) { 544 e.preventDefault(); 545 546 var parent = $(this).parent().parent(); 547 548 if (!parent.hasClass('active')) { 549 //Reset active and height 550 parent.siblings().removeClass('active'); 551 parent.siblings().find('.mega-menu-item').removeClass('active'); 552 553 parent.addClass('active'); 554 555 556 } else if (parent.hasClass('active')) { 557 //Reset active and height for inner items 558 parent.removeClass('active'); 559 560 } 561 562 return false;
563 }); 564 } 565 } 566 } 567 568 /* # Wide menu */ 569 function wideMenuOnLoadPosition() { 570 571 var $subMenu = $('.nav-container .sub-menu-wide'); 572 573 $subMenu.each(function () { 574 var wideMenuOffsetLeft = $(this).parent().find('.menu-link').offset().left, 575 windowHeight = $(window).height(), 576 menuSpacer = (windowHeight / 100) * 4.4, 577 wideMenuPosition = wideMenuOffsetLeft - menuSpacer; 578 579 $(this).css('left', (wideMenuPosition) * -1); 580 }); 581 } 582 583 function wideMenuOnResizePosition() { 584 585 var $subMenu = $('.nav-container .sub-menu-wide'); 586 587 $subMenu.css('left', ''); 588 589 setTimeout(function () { 590 $subMenu.each(function () { 591 var wideMenuOffsetLeft = $(this).parent().find('.menu-link').offset().left, 592 windowHeight = $(window).height(), 593 menuSpacer = (windowHeight / 100) * 4.4, 594 wideMenuPosition = wideMenuOffsetLeft - menuSpacer; 595 596 $(this).css('left', (wideMenuPosition) * -1); 597 }); 598 }, 1000); 599 600 } 601 602 /* # Footer */ 603 604 function handleFooter() { 605 // Sticky 606 var stickyFooter = $('.site-footer.sticky'); 607 if (stickyFooter.length && !Clb.isPad) { 608 $('.site-content').css({ 609 'margin-bottom': stickyFooter.outerHeight() + 'px', 610 'position': 'relative', 611 'z-index': '2' 612 }); 613 stickyFooter.addClass('visible'); 614 } 615 }; 616 617 function handleFooterSize() { 618 var stickyFooter = $('.site-footer.sticky'); 619 if (stickyFooter.length) { 620 if (!Clb.isPad) { 621 stickyFooter.css({ 622 'width': stickyFooter.parent().outerWidth() + 'px', 623 'left': stickyFooter.parent().offset().left + 'px', 624 }); 625 $('.site-content').css({ 626 'margin-bottom': stickyFooter.outerHeight() + 'px', 627 'position': 'relative', 628 'z-index': '2' 629 }); 630 } else { 631 $('.site-content').css({ 632 'margin-bottom': '', 633 'position': '', 634 'z-index': '' 635 }); 636 stickyFooter.css({ 637 'width': '', 638 'left': '', 639 }); 640 } 641 } 642 } 643 644 /* # Shortcodes */ 645 646 /* ## Accordion box */ 647 648 function handleAccordionBox() { 649 $('[data-ohio-accordion]').each(function () { 650 var accordion = $(this); 651 var titles = $(this).find('.accordionItem_title'); 652 var items = $(this).find('.accordionItem'); 653 var contents = $(this).find('.accordionItem_content'); 654 var iconOpened = 'ion-md-remove', iconClosed = 'ion-md-add'; 655 var isOutline = $(this).hasClass('outline'); 656 657 var toggle = function (num) { 658 659 var opened = accordion.find('.visible'); 660 var content = contents.eq(num); 661 662 // If not active 663 if (!items.eq(num).hasClass('active')) { 664 // Activate this item 665 items.removeClass('active'); 666 items.eq(num).addClass('active'); 667 668 setTimeout(function () { 669 content.css('height', '').addClass('no-transition visible'); // Open new content 670 var height = content.outerHeight() + 'px'; // Save heights 671 content.removeClass('no-transition visible').css('height', (isOutline) ? '0px' : '10px'); // Close new content 672 673 setTimeout(function () { 674 opened.removeClass('visible no-transition').css('height', (isOutline) ? '0px' : '10px'); // Close old content 675 content.addClass('visible').css('height', height); // Open new content 676 677 // Change titles 678 titles.find('.accordionItem_control i').removeClass(iconOpened).addClass(iconClosed); 679 titles.eq(num).find('.accordionItem_control i').removeClass(iconClosed).addClass(iconOpened); 680 }, 30); 681 }, 30); 682 } else { 683 items.eq(num).removeClass('active'); 684 items.eq(num).find('.accordionItem_content.visible').removeClass('visible').css('height', (isOutline) ? '0px' : '10px'); // Close old content 685 items.eq(num).find('.accordionItem_title .accordionItem_control i').removeClass(iconOpened).addClass(iconClosed); 686 } 687 }; 688 689 titles.each(function (i) { 690 $(this).on('click', function () { 691 toggle(i); 692 }); 693 }); 694 695 //toggle($(this).attr('data-ohio-accordion') || 0); 696 697 this.accordionToggle = toggle; 698 }); 699 }; 700 $(window).on('ohio:handle_accordion_box', handleAccordionBox); 701 702 function handleAccordionBoxSize() { 703 $('[data-ohio-accordion]').each(function () { 704 var content = $(this).find('.accordionItem_content.visible'); 705 var items = $(this).find('.accordionItem'); 706 var wrap = content.find('.wrap'); 707 708 items.each(function () { 709 var icon = $(this).hasClass('active') ? 'ion-md-remove' : 'ion-md-add'; 710 $(this).find('.accordionItem_control i').addClass(icon); 711 }); 712 713 content.css('height', wrap.outerHeight() + 'px'); 714 }); 715 }; 716 $(window).on('ohio:handle_accordion_box_size', handleAccordionBoxSize); 717 718 /* ## Banner box */ 719 720 function handleBannerBox() { 721 $('.banner-box.overlay-title.hover').each(function () { 722 $(this).on("hover", function () { 723 var self = $(this); 724 var content = $(this).find('.title-wrap'); 725 var description = $(this).find('.description-wrap'); 726 727 description.css('margin-top', -content.outerHeight() + 'px'); 728 }, 729 function () { 730 var self = $(this), newHeight = 0, oldHeight = 0; 731 self.find('.description-wrap').css('margin-top', ''); 732 }); 733 }); 734 } 735 736 function handleBannerBoxSize() { 737 $('.banner-box.overlay-title.hover').each(function () { 738 var newHeight = 0, 739 titles = $(this).find('.title-wrap'); 740 741 $(this).css('height', ''); 742 $(this).css('height', ($(this).outerHeight() - titles.outerHeight()) + 'px'); 743 }); 744 } 745 746 /* ## Counter box */ 747 748 function handleCounterBox() { 749 $('[data-counter]').each(function () { 750 var counter = $(this); 751 var scrollTop = $(document).scrollTop() + $(window).height(); 752 753 if (scrollTop > counter.offset().top + counter.height()) { 754 var countEnd = parseInt(counter.attr('data-counter').replace(/\s/g, '')); 755 counter.removeAttr('data-counter'); 756 757 for (var j = 0; j <= 20; j++) { 758 (function (count) { 759 760 setTimeout(function () { 761 var number = Math.round((countEnd / 20) * count); 762 763 counter.find('.count').html(number); 764 }, 50 * count); 765 766 })(j); 767 } 768 } 769 }); 770 }; 771 $(window).on('ohio:handle_counter_box', handleCounterBox); 772 773 /* ## Contact form */ 774 775 function handleSubscribeContactForm() { 776 // Button 777 $('.contact-form').each(function () { 778 var submit = $(this).find('[type="submit"]'); 779 var button = $(this).find('[data-contact-btn] button'); 780 781 if (submit.length) { 782 button.find('.text').html(submit.val()); 783 submit.replaceWith(button); 784 $(this).find('.ajax-loader').remove(); 785 } 786 787 // For focus 788 if ($(this).hasClass('without-label-offset')) { 789 $(this).find('.wpcf7-form-control-wrap').after('<div class="focus"></div>'); 790 791 $(this).find('input, textarea, select').on('focus', function () { 792 $(this).parent().parent().find('.focus').addClass('active'); 793 }).on('blur', function () { 794 $(this).parent().parent().find('.focus').removeClass('active'); 795 }); 796 } 797 }); 798 799 // Loader 800 $('.contact-form form').on('submit', function () { 801 var btn = $(this).find('.btn'); 802 803 if (btn.hasClass('btn-link')) { 804 btn.addClass("btn-loading"); 805 btn.find('.text').css('display', 'none'); 806 } else { 807 btn.addClass("btn-loading"); 808 } 809 810 811 });
812 $(document).on('spam.wpcf7 invalid.wpcf7 spam.wpcf7 mailsent.wpcf7 mailfailed.wpcf7 unaccepted.wpcf7', function (e) { 813 var form = $('.contact-form'); 814 $(form).find('.btn').removeClass("btn-loading"); 815 816 if ($(form).find('.btn').hasClass('btn-link')) { 817 $(form).find('.btn .text').css('display', 'block'); 818 } 819 }); 820 } 821 $(window).on('ohio:handle_contact_forms', handleSubscribeContactForm); 822 823 /* ## Countdown box */ 824 function handleCountdownBox() { 825 $("[data-countdown-box]").each(function () { 826 var countdownBox = $(this); 827 var labels = countdownBox.attr('data-countdown-labels').split(','), 828 parser = /([0-9]{2})/gi; 829 830 // Return the time components that diffs 831 var diff = function (obj1, obj2) { 832 var diff = []; 833 labels.forEach(function (key) { 834 if (obj1[key] !== obj2[key]) { 835 diff.push(key); 836 } 837 }); 838 return diff; 839 } 840 // Parse countdown string to an object 841 var strfobj = function (str) { 842 var parsed = str.match(parser), 843 obj = {}; 844 labels.forEach(function (label, i) { 845 obj[label] = parsed[i] 846 }); 847 return obj; 848 } 849 850 var template = $("#" + countdownBox.attr("data-countdown-box")).html(), 851 currentDate = '00:00:00:00:00', 852 nextDate = '00:00:00:00:00'; 853 // Build the layout 854 var initData = strfobj(currentDate); 855 labels.forEach(function (label, i) { 856 let preparedTemplate = template.replace(/\<\%\= current \%\>/g, initData[label]); 857 preparedTemplate = preparedTemplate.replace(/\<\%\= next \%\>/g, initData[label]); 858 preparedTemplate = preparedTemplate.replace(/\<\%\= label \%\>/g, label); 859 860 countdownBox.append(preparedTemplate); 861 }); 862 // Starts the countdown 863 countdownBox.countdown(new Date($(this).attr("data-countdown-time")), function (event) { 864 window.c = event; 865 var newDate = event.strftime('%m:%n:%H:%M:%S'), data; 866 if (newDate !== nextDate) { 867 currentDate = nextDate; 868 nextDate = newDate; 869 // Setup the data 870 data = { 871 'current': strfobj(currentDate), 872 'next': strfobj(nextDate) 873 }; 874 // Apply the new values to each node that changed 875 diff(data.current, data.next).forEach(function (label) { 876 var selector = '.%s'.replace(/%s/, label), 877 node = countdownBox.find(selector); 878 // Update the node 879 node.removeClass('flip'); 880 node.find('.box-current .number').text(data.current[label]); 881 node.find('.box-next .number').text(data.next[label]); 882 // Wait for a repaint to then flip 883 setTimeout(function () { 884 node.addClass('flip'); 885 }, 50); 886 }); 887 } 888 }); 889 }); 890 } 891 $(window).on('ohio:handle_countdown_box', handleCountdownBox); 892 893 /* ## Cover box */ 894 895 function handleCoverBox() { 896 $('[data-ohio-cover-box]').each(function () { 897 var box = $(this), 898 items = $(this).find('[data-item]'), 899 triggers = $(this).find('[data-trigger]'); 900 901 var selected = -1; 902 903 var openItem = function (num) { 904 items.removeClass('active'); 905 var item = items.eq(num).addClass('active'); 906 907 if (selected != num && !Clb.isMobile) { 908 selected = num; 909 910 item.addClass('no-transition'); 911 item.css('width', ''); 912 913 var width = item.outerWidth(); 914 item.css('width', '0'); 915 916 setTimeout(function () { 917 item.removeClass('no-transition'); 918 items.css('width', '0'); 919 item.css('width', (width - 2) + 'px'); 920 }, 30); 921 } 922 }; 923 924 triggers.on('mouseenter', function () { 925 openItem(triggers.index($(this))); 926 }); 927 928 openItem(0); 929 }); 930 } 931 $(window).on('ohio:handle_cover_box', handleCoverBox); 932 933 function handleCoverBoxSize() { 934 $('[data-ohio-cover-box]').each(function () { 935 var box = $(this); 936 937 box.find('[data-item]').each(function (i) { 938 if (!Clb.isMobile) { 939 $(this).css('height', box.find('[data-trigger]').eq(i).outerHeight() + 'px'); 940 $(this).find(' > * ').css('width', box.find('[data-trigger]').eq(i).outerWidth() + 'px'); 941 } else { 942 $(this).css({ 943 'height': '', 944 'width': '' 945 }); 946 947 $(this).find(' > * ').css({ 948 'height': '', 949 'width': '' 950 }); 951 } 952 }); 953 }); 954 } 955 $(window).on('ohio:handle_cover_box_size', handleCoverBoxSize); 956 957 /* ## Gallery */ 958 959 function handleGallery() { 960 // Open popup 961 $('body').on('click', '[data-gallery-item]', function () { 962 Clb.body.addClass('gallery-opened'); 963 var gallery = $(this).closest('[data-gallery]'), 964 popup = $('#' + gallery.attr('data-gallery')), 965 images = gallery.find('.gallery-image'), 966 options = popup[0].options; 967 968 if ($('.site-footer.sticky').length && !Clb.isMobile && Clb.header && Clb.header) { 969 Clb.header.css('z-index', '1'); 970 } 971 handlePopup(popup); 972 973 if ($('.single-product').length > 0) { 974 var image = $(this).parents('.woo_c-product-image-slider').find('.gimg').eq(0); 975 } else { 976 var image = $(this).find('.gimg').eq(0); 977 } 978 979 // Clone image for move 980 var cloneImg = image.clone().css({ 981 'height': image.outerHeight() + 'px', 982 'top': image.offset().top - $(window).scrollTop(), 983 'left': image.offset().left, 984 }).addClass('gallery-tmpimage'); 985 986 // Create slider 987 var slider = $(document.createElement('div')).addClass('slider'); 988 popup.find('.clb-popup-holder').append(slider); 989 // Generated slider 990 images.each(function () { 991 992 var div = $(document.createElement('div')); 993 994 div.addClass('image-wrap').append($(this).find('.gimg').eq(0).clone()); 995 996 var imgDetails = $(this).find('.clb-gallery-img-details'); 997 if (imgDetails.length) { 998 var description = imgDetails.clone(); 999 div.append(description).addClass('with-description'); 1000 1001 if ($(window).width() > 787) { 1002 setTimeout(function () { 1003 div.find('.image-wrap').css('height', 'calc(100% - ' + (description.outerHeight() - 5) + 'px)') 1004 }, 10); 1005 } 1006 } 1007 slider.append(div); 1008 }); 1009 1010 var imageNumber = $(this).attr('data-gallery-item'); 1011 1012 slider.clbSlider({ 1013 navBtn: true, 1014 drag: true, 1015 dots: false, 1016 startSlide: imageNumber 1017 }); 1018 1019 slider.find('.clb-slider-nav-btn .btn-round').removeClass('btn-round-light'); 1020 1021 // Move tmp image 1022 1023 $(document.body).append(cloneImg); 1024 1025 var sliderImg = slider.find('img.gimg').eq(imageNumber); 1026 1027 setTimeout(function () { 1028 cloneImg.css({ 1029 'height': sliderImg.outerHeight() + 'px', 1030 'top': (sliderImg.offset().top - popup.offset().top) + 'px', 1031 'left': '', 1032 'margin-left': '-' + (sliderImg.outerWidth() / 2) + 'px' 1033 }).addClass('active'); 1034 slider.addClass('ready'); 1035 // Open slider, remove tmp image 1036 setTimeout(function () { 1037 slider.addClass('visible'); 1038 }, 200); 1039 1040 setTimeout(function () { 1041 cloneImg.remove(); 1042 }, 800); 1043 }, 100); 1044
1045 popup.expanded = false; 1046 1047 var expand = function () { 1048 if (popup.expanded) { 1049 document.webkitCancelFullScreen(); 1050 $(this).find('.ion').addClass('ion-md-expand').removeClass('ion-md-contract'); 1051 popup.expanded = false; 1052 } else { 1053 popup.expanded = true; 1054 popup[0].webkitRequestFullscreen(); 1055 $(this).find('.ion').removeClass('ion-md-expand').addClass('ion-md-contract'); 1056 } 1057 }; 1058 1059 $(popup).find('.expand').on('click', expand); 1060 $(popup).find('.clb-close').on('click', function () { 1061 Clb.body.removeClass('gallery-opened'); 1062 if (popup.expanded) { 1063 document.webkitCancelFullScreen(); 1064 popup.expanded = false; 1065 } 1066 }); 1067 }); 1068 } 1069 $(window).on('ohio:handle_gallery', handleGallery); 1070 1071 /* ## Parallax */ 1072 1073 function initParallax() { 1074 $('[data-parallax-bg]').each(function () { 1075 var parallax = $(this); 1076 parallax.parent('.wpb_wrapper').addClass('full-height'); 1077 var bg = parallax.find('.parallax-bg'); 1078 var speed = parallax.attr('data-parallax-speed'); 1079 parallax.data('oldHeight', bg.height()); 1080 parallax.data('isHeadlineLoad', true); 1081 1082 if (parallax.attr('data-parallax-bg') == 'vertical') { 1083 parallax.find('.parallax-bg').css({ 1084 height: (parallax.outerHeight() + speed * 200) + 'px' 1085 }); 1086 } else { 1087 parallax.find('.parallax-bg').css({ 1088 width: (parallax.outerWidth() + speed * 200) + 'px' 1089 }); 1090 } 1091 bg.addClass((parallax.attr('data-parallax-bg') == 'vertical') ? '' : 'horizontal'); 1092 }); 1093 }; 1094 1095 function handleParallax() { 1096 var contentScroll = $(document).scrollTop(); 1097 var wndHeight = $(window).height(); 1098 1099 $('[data-parallax-bg]').each(function () { 1100 var parallax = $(this); 1101 var parallaxTop = parallax.offset().top; 1102 var parallaxHeight = parallax.outerHeight(); 1103 var parallaxWidth = parallax.outerWidth(); 1104 1105 // If parallax block on screen 1106 if (parallaxTop <= contentScroll + wndHeight && parallaxTop + parallaxHeight >= contentScroll) { 1107 1108 var speed = parseFloat(parallax.attr('data-parallax-speed')) * 100; 1109 var bg = parallax.find('.parallax-bg'); 1110 var newHeight = bg.height(); 1111 var oldHeight = parallax.data('oldHeight'); 1112 1113 var percent = (-parallaxTop + contentScroll + wndHeight) / (parallaxHeight + wndHeight); 1114 var offset = -(percent * 2) * speed; 1115 if (parallax.parents('.clb-page-headline').length && parallax.data('isHeadlineLoad')) { 1116 if (parallax.attr('data-parallax-bg') == 'vertical') { 1117 bg.css('transform', 'translate3d(0, ' + (-(newHeight - oldHeight) / 2) + 'px, 0)'); 1118 parallax.data('isHeadlineLoad', false) 1119 } 1120 } else { 1121 if (parallax.attr('data-parallax-bg') == 'vertical') { 1122 bg.css('transform', 'translate3d(0, ' + offset + 'px, 0)'); 1123 if (parallax.parents('.clb-page-headline').length) { 1124 bg.css('transition', 'transform linear 0.1s'); 1125 } 1126 1127 } else { 1128 bg.css('transform', 'translate3d(' + offset + 'px, 0, 0)'); 1129 } 1130 } 1131 } 1132 }); 1133 }; 1134 1135 /* ## Progress bar */ 1136 1137 function handleProgressBar() { 1138 $("[data-ohio-progress-bar]:not([data-processed])").each(function () { 1139 var percent, 1140 bar = $(this), 1141 line = bar.find('.line'), 1142 progressEnd = parseInt(bar.attr("data-ohio-progress-bar")), 1143 withTooltip = bar.find('[data-tooltip]').length; 1144 1145 var scrollTop = $(document).scrollTop() + $(window).height(); 1146 1147 if (line.length == 0 && bar.hasClass('split')) { 1148 var div = $(document.createElement('div')).addClass('line-split'); 1149 1150 div.append($(document.createElement('div')).addClass('line brand-bg-color')); 1151 1152 for (var i = 0; i < 8; i++) { 1153 var div = div.clone(); 1154 1155 bar.find('.line-wrap').append(div); 1156 1157 div.find('.line').css({ 1158 'left': -(div.offset().left - bar.offset().left) + 'px' 1159 }); 1160 } 1161 1162 if (withTooltip) { 1163 bar.find('.line-wrap').append('<div class="line"><h4 class="line-percent"><span class="percent">0</span>%</h4></div>'); 1164 } 1165 1166 line = bar.find('.line'); 1167 } 1168 1169 percent = bar.find('.percent'); 1170 1171 if (scrollTop > bar.offset().top + bar.height()) { 1172 bar.attr("data-processed", "true"); 1173 if (bar.hasClass('inner')) { 1174 line.css("width", (bar.outerWidth() * (progressEnd / 100) - 8) + "px"); 1175 } else { 1176 line.css("width", (bar.outerWidth() * (progressEnd / 100)) + "px"); 1177 } 1178 1179 for (var j = 0; j <= 40; j++) { 1180 (function (count) { 1181 setTimeout(function () { 1182 percent.html(Math.round((progressEnd / 40) * count)); 1183 }, 30 * count); 1184 })(j); 1185 } 1186 } 1187 }); 1188 } 1189 $(window).on('ohio:handle_progress_bar', handleProgressBar); 1190 1191 /* ## Progress bar size */ 1192 1193 function handleProgressBarSize() { 1194 $("[data-ohio-progress-bar][data-processed]").each(function () { 1195 var bar = $(this); 1196 var line = bar.find('.line'); 1197 var progressEnd = parseInt(bar.attr("data-ohio-progress-bar")); 1198 1199 if (bar.hasClass('inner')) { 1200 line.css("width", (bar.outerWidth() * (progressEnd / 100) - 8) + "px"); 1201 } else { 1202 line.css("width", (bar.outerWidth() * (progressEnd / 100)) + "px"); 1203 } 1204 1205 bar.find('.line-split').each(function () { 1206 $(this).find('.line').css({ 1207 'left': -($(this).offset().left - bar.offset().left) + 'px' 1208 }); 1209 }); 1210 }); 1211 } 1212 1213 /* ## Price table */ 1214 1215 function handlePriceTable() { 1216 if (!Clb.isMobile) { 1217 $('.pricing-table.features').each(function () { 1218 var row = $(this).parents('.vc_row').eq(0); 1219 var table = row.find('.pricing-table').eq(1); 1220 1221 // Calculate position 1222 $(this).css({ 1223 'padding-top': (table.find('.list-box').eq(0).offset().top - table.offset().top - $(this).find('h3').outerHeight() - 15) + 'px', 1224 'min-height': table.outerHeight() + 'px' 1225 }); 1226 1227 1228 // Calculate sizes 1229 $(this).find('li').each(function (i) { 1230 var max = 0; 1231 row.find('.pricing-table').each(function () { 1232 var h = $(this).find('li').eq(i).outerHeight(); 1233 if (h > max) { 1234 max = h; 1235 } 1236 }); 1237 row.find('.pricing-table').each(function () { 1238 $(this).find('li').eq(i).css({ 1239 'height': max + 'px', 1240 }); 1241 }); 1242 }); 1243 }); 1244 } else { 1245 $('.pricing-table.features').each(function () { 1246 $(this).css({ 1247 'padding-top': '', 1248 'min-height': '' 1249 }); 1250 }); 1251 } 1252 }; 1253 1254 /* ## Split box */ 1255 1256 function handleSplitboxParallax() { 1257 var process = function (side, num) { 1258 if ($(this).attr('data-parallax-' + side)) { 1259 $(this).find('.split-box-container').eq(num).attr({ 1260 'data-parallax-bg': $(this).attr('data-parallax-' + side), 1261 'data-parallax-speed': $(this).attr('data-parallax-speed-' + side) 1262 }); 1263 } else { 1264 $(this).find('.split-box-container').eq(num).find('.parallax-bg').css({ 1265 'height': '100%', 1266 'width': '100%' 1267 }); 1268 } 1269 }; 1270 1271 $('.split-box').each(function () { 1272 process.call(this, 'left', 0); 1273 process.call(this, 'right', 1); 1274 }); 1275 } 1276 1277 /* ## Sliders */ 1278 1279 function handleSliders(image) { 1280 1281 if (image === undefined) { 1282 image = $('.gimg'); 1283 } 1284 1285 $('[data-ohio-slider]').each(function () { 1286 var carousel = $(this); 1287 var options = $(this).attr('data-ohio-slider'); 1288 options = (options) ? JSON.parse(options) : {}; 1289 1290 if (options.autoplay) { 1291 options.autoplayTimeout = options.autoplayTimeout * 1000; 1292 } 1293 1294 options.items = +options.itemsDesktop || 5, 1295 options.responsive = { 1296 1024: { 1297 items: +options.itemsTablet || 3, 1298 }, 1299 768: { 1300 items: +options.itemsMobile || 1, 1301 } 1302 }; 1303 1304 1305 delete options.itemsDesktop; 1306 delete options.itemsTablet; 1307 delete options.itemsMobile; 1308 1309 carousel.clbSlider(options); 1310 1311 if (carousel.hasClass('with-preloader')) { 1312 carousel.addClass('visible'); 1313 carousel.parent().find('.sk-preloader').addClass('hidden'); 1314 } 1315 1316 carousel.find('.elementor-invisible').removeClass('elementor-invisible'); 1317 }); 1318 1319 $('[data-ohio-slider-simple]').each(function () { 1320 var carousel = $(this); 1321 1322 carousel.clbSlider({ 1323 dots: false, 1324 verticalScroll: false, 1325 loop: true, 1326 autoHeight: true 1327 }).on('clb-slider.changed', function () { 1328 setTimeout(function () { 1329 $('.ohio-masonry').masonry(); 1330 }, 250); 1331 }); 1332 1333 carousel.find('.elementor-invisible').removeClass('elementor-invisible'); 1334 }); 1335 } 1336 $(window).on('ohio:handle_sliders', handleSliders); 1337 1338 function handleFullscreenSlider() { 1339 var onepage = $('.fullscreen-slider'); 1340 if (onepage.length) { 1341 1342 if (onepage.find('.ohio-dynamic-text-sc ')) { 1343 handleOhioDynamicTextSc(); 1344 } 1345 1346 var options = JSON.parse(onepage.attr('data-options')); 1347 1348 onepage.clbSlider(options); 1349 1350 var onepageOffset = onepage.offset().top; 1351 var onepageHeight = onepage.height(); 1352 1353 var divNav = $('#mega-menu-wrap > ul > li > a, #masthead .menu-optional > li a, #masthead .ion:not(.ion-md-add)'); 1354 var pagination = onepage.find('.clb-slider-nav-btn .btn-round, .clb-slider-pagination .clb-slider-page'); 1355 var dots = onepage.find('.clb-slider-nav-dots .clb-slider-dot'); 1356 var social = $('.clb-social-holder li'); 1357 var search = $('.search-global'); 1358 var scroll = $('.clb-scroll-top'); 1359 1360 onepage.on('clb-slider.changed', function () { 1361 var item = onepage.find('.clb-slider-outer-stage > .clb-slider-stage > .clb-slider-item.active'); 1362 var activedot = onepage.find('.clb-slider-nav-dots .clb-slider-dot.active'); 1363 1364 var paginationColor = item.data('pagination-color'); 1365 var menuColor = item.data('header-nav-color'); 1366 var socialColor = item.data('social-networks-color'); 1367 var searchColor = item.data('search-color'); 1368 var scrollColor = item.data('scroll-to-top-color'); 1369 var logoType = item.data('header-logo-type'); 1370 1371 divNav.css('transition', 'none'); 1372 pagination.css('transition', 'none'); 1373 dots.css('transition', 'none'); 1374 activedot.css('transition', 'none'); 1375 social.css('transition', 'none'); 1376 search.find('.ion').css('transition', 'none'); 1377 scroll.css('transition', 'none'); 1378 1379 divNav.css('color', menuColor ? menuColor : ''); 1380 pagination.css('color', (paginationColor) ? paginationColor : ''); 1381 dots.css('color', (paginationColor) ? paginationColor : ''); 1382 activedot.css('border-color', (paginationColor) ? paginationColor : ''); 1383 social.css('color', (socialColor) ? socialColor : ''); 1384 search.css('color', (searchColor) ? searchColor : ''); 1385 scroll.css('color', (scrollColor) ? scrollColor : ''); 1386 1387 if (logoType) {
1388 if (Clb.logo.length && Clb.fixedLogo.length) { 1389 $([Clb.logo[0], Clb.fixedLogo[0]]).css({ 1390 'position': 'absolute', 1391 'width': '0px', 1392 'height': '0px', 1393 'overflow': 'hidden' 1394 }); 1395 } 1396 1397 if (logoType == 'dark' && Clb.logoForOnepageDark) { 1398 if (Clb.logoForOnepageLight) { 1399 Clb.logoForOnepageLight.addClass('hidden'); 1400 } 1401 Clb.logoForOnepageDark.removeClass('hidden'); 1402 } 1403 if (logoType == 'light' && Clb.logoForOnepageLight) { 1404 if (Clb.logoForOnepageDark) { 1405 Clb.logoForOnepageDark.addClass('hidden'); 1406 } 1407 Clb.logoForOnepageLight.removeClass('hidden'); 1408 } 1409 } else { 1410 defaultLogo(); 1411 } 1412 1413 setTimeout(function () { 1414 divNav.css('transition', ''); 1415 pagination.css('transition', ''); 1416 dots.css('transition', ''); 1417 activedot.css('transition', ''); 1418 social.css('transition', ''); 1419 search.find('.ion').css('transition', ''); 1420 scroll.css('transition', ''); 1421 }, 300); 1422 }); 1423 1424 if ($(window).scrollTop() > (onepageOffset) || $(window).scrollTop() < onepageOffset) { 1425 toggleSliderScrollBar('hide-all'); 1426 } 1427 1428 $(window).on('scroll', function () { 1429 if ($(window).scrollTop() > (onepageOffset + onepageHeight) || $(window).scrollTop() < onepageOffset) { 1430 divNav.css('color', ''); 1431 defaultLogo(); 1432 } 1433 1434 if ($(window).scrollTop() > (onepageOffset) || $(window).scrollTop() < onepageOffset) { 1435 toggleSliderScrollBar('hide'); 1436 } else { 1437 toggleSliderScrollBar('show'); 1438 } 1439 }); 1440 } 1441 1442 function defaultLogo() { 1443 if (Clb.logoForOnepageDark) { 1444 Clb.logoForOnepageDark.addClass('hidden'); 1445 } 1446 if (Clb.logoForOnepageLight) { 1447 Clb.logoForOnepageLight.addClass('hidden'); 1448 } 1449 $([Clb.logo[0], Clb.fixedLogo[0]]).css({ 1450 'position': '', 1451 'width': '', 1452 'height': '', 1453 'overflow': '' 1454 }); 1455 } 1456 } 1457 $(window).on('ohio:handle_fullscreen_sliders', handleFullscreenSlider); 1458 1459 function toggleSliderScrollBar(toggle) { 1460 var scrollTop = $('.clb-scroll-top:not(.clb-slider-scroll-top)'); 1461 var sliderSCrollTop = $('.clb-slider-scroll-top '); 1462 1463 if (toggle == 'show') { 1464 scrollTop.addClass('invisible').removeClass('visible'); 1465 sliderSCrollTop.addClass('visible').removeClass('invisible'); 1466 } else if (toggle == 'hide') { 1467 scrollTop.addClass('visible').removeClass('invisible'); 1468 sliderSCrollTop.addClass('invisible').removeClass('visible'); 1469 } else if (toggle == 'hide-all') { 1470 scrollTop.addClass('invisible').removeClass('visible'); 1471 sliderSCrollTop.addClass('invisible').removeClass('visible'); 1472 } 1473 } 1474 /* ## Tabs */ 1475 1476 function handleTabBox() { 1477 $('[data-ohio-tab-box]').each(function () { 1478 var box = $(this); 1479 var buttons = $(this).find('.tabNav_link'); 1480 var buttonsWrap = $(this).find('.tabNav'); 1481 var line = $(this).find('.tabNav .tabNav_line'); 1482 var items = $(this).find('.tabItems_item'); 1483 var options = (box.attr('data-options')) ? JSON.parse(box.attr('data-options')) : {}; 1484 var nextBtn = $(this).find('.next-btn:not(.btn-round)'); 1485 var tabOffset = box.offset().top; 1486 1487 // Initializtion 1488 if (buttons.length == 0) { 1489 items.each(function () { 1490 var title = $(this).attr('data-title'); 1491 box.find('.tabNav').append($(document.createElement('li')).addClass('tabNav_link ' + options.tabClass).html(title)); 1492 }); 1493 buttons = $(this).find('.tabNav_link'); 1494 buttons.eq(0).addClass('active ' + options.tabActiveClass); 1495 } 1496 1497 if (!box.find('.tabItems_item.active').length) { 1498 items.eq(0).addClass('active'); 1499 } 1500 1501 items.addClass(options.itemClass); 1502 1503 1504 // Process 1505 var refresh = function () { 1506 // Height 1507 var activeItem = box.find('.tabItems_item.active'); 1508 if (box.hasClass('vertical') && buttonsWrap.outerHeight() > activeItem.outerHeight()) { 1509 box.find('.tabItems').css('height', activeItem.outerHeight() + 'px'); 1510 } else { 1511 box.find('.tabItems').css('height', activeItem.outerHeight() + 'px'); 1512 } 1513 1514 // Line 1515 var active = box.find('.tabNav .active'); 1516 if (box.hasClass('vertical') && !Clb.isMobile) { 1517 line.css({ 1518 'height': active.outerHeight() + 'px', 1519 'transform': 'translateY(' + (active.offset().top - buttonsWrap.offset().top) + 'px)' 1520 }); 1521 } else { 1522 line.css({ 1523 'width': active.outerWidth() + 'px', 1524 'transform': 'translateX(' + (active.offset().left - buttonsWrap.offset().left + buttonsWrap.scrollLeft()) + 'px)' 1525 }); 1526 } 1527 }; 1528 1529 buttons.on('click', function () { 1530 buttons.removeClass('active ' + options.tabActiveClass).addClass(options.tabClass); 1531 items.removeClass('active'); 1532 1533 $(this).addClass('active ' + options.tabActiveClass); 1534 items.eq($(this).index() - 1).addClass('active'); 1535 1536 refresh(); 1537 }); 1538 1539 var nextTab = function (element) { 1540 1541 element.each(function (i) { 1542 if (element.eq(i).hasClass('active')) { 1543 element.eq(i).removeClass('active'); 1544 element.eq(i).next().addClass('active ' + options.tabActiveClass); 1545 return false;
1546 } 1547 }); 1548 } 1549 1550 if ($('#masthead[data-header-fixed]').length) { 1551 tabOffset -= 70; 1552 } 1553 1554 nextBtn.on('click', function () { 1555 event.preventDefault(); 1556 nextTab(buttons); 1557 nextTab(items); 1558 refresh(); 1559 $('body, html').animate({ scrollTop: tabOffset }, 500); 1560 1561 }); 1562 1563 //Single product smooth scroll to review 1564 $(".write-review, .woo-review-link").on("click", function (event) { 1565 productReviewSmoothScroll(event); 1566 }); 1567 1568 if (window.location.href.includes('#product_review')) { 1569 productReviewSmoothScroll(); 1570 } 1571 1572 function productReviewSmoothScroll(event) { 1573 if (event) { 1574 event.preventDefault(); 1575 } 1576 1577 var tab = $('#product_review'); 1578 1579 tab.find('.tabNav_link').removeClass('active'); 1580 tab.find('.tabItems_item').removeClass('active'); 1581 1582 var top = tab.offset().top; 1583 $('body,html').animate({ scrollTop: (top) }, 700); 1584 1585 tab.find('.tabNav_link[data-ohio-tab="reviews"]').addClass('active'); 1586 tab.find('.tabItems_item[data-ohio-tab-content="reviews"]').addClass('active'); 1587 1588 refresh(); 1589 } 1590 1591 refresh(); 1592 1593 }); 1594 }; 1595 $(window).on('ohio:handle_tab_box', handleTabBox); 1596 1597 function handleTabBoxSize() { 1598 $('[data-ohio-tab-box]').each(function () { 1599 var box = $(this); 1600 var activeItem = box.find('tabItems_item.active'); 1601 var buttonsWrap = box.find('.tabNav'); 1602 1603 if (box.hasClass('vertical') && buttonsWrap.outerHeight() > activeItem.outerHeight()) { 1604 box.find('.tabItems_item').css('height', activeItem.outerHeight() + 'px'); 1605 } else { 1606 box.find('.tabItems_item').css('height', activeItem.outerHeight() + 'px'); 1607 } 1608 }); 1609 }; 1610 $(window).on('ohio:handle_tab_box_size', handleTabBoxSize); 1611 1612 /* ## Video Background */ 1613 1614 function handleVideoBackground() { 1615 $('[data-arg-video-bg]').each(function () { 1616 var videoLink = $(this).attr('data-arg-video-bg'); 1617 var iframe = $(document.createElement('iframe')); 1618 1619 iframe.addClass('arg-video-bg').attr('src', videoLink); 1620 $(this).append(iframe); 1621 }); 1622 } 1623 1624 /* ## Theme popup */ 1625 function handlePopup(data) { 1626 $(data).each(function () { 1627 // Activate popup 1628 $(this).addClass('visible'); 1629 $(this).find('.btn-loading-disabled').addClass('btn-loading'); 1630 }); 1631 1632 1633 // setTimeout(function () { 1634 // popup.addClass('open'); 1635 // }, 30); 1636 } 1637 1638 $(document).on('keydown', function (e) { 1639 var popup = $('.clb-popup'); 1640 1641 if (e.keyCode == 27) { 1642 closePopup(popup); 1643 } 1644 }); 1645 1646 $('body').on('click keydown', '.clb-popup .clb-close, .clb-popup .subscribe-nothanks-btn', function (e) { 1647 e.preventDefault(e); 1648 var popup = $(this).closest('.clb-popup'); 1649 closePopup(popup); 1650 }); 1651 1652 function closePopup(popup) { 1653 // Close button 1654 setTimeout(function () { 1655 popup.removeClass('visible'); 1656 popup.find('.clb-popup-holder').empty(); 1657 popup.find('.clb-popup-holder').removeClass().addClass('clb-popup-holder'); 1658 1659 if ($('.site-footer.sticky').length && !Clb.isMobile && Clb.header && Clb.head.length) { 1660 Clb.header.css('z-index', '1000'); 1661 } 1662 }, 200); 1663 1664 } 1665 1666 /* ## Video popup */ 1667 function handleVideoPopup() { 1668 $(document).on('click', '.video-module', function (event) { 1669 event.preventDefault(); 1670 var videoPopup = $('.clb-popup.custom-popup'); 1671 1672 handlePopup(videoPopup); 1673 var popupInner = videoPopup.find('.clb-popup-holder').addClass('clb-video-popup'); 1674 1675 popupInner.siblings('.btn-loading-disabled').removeClass('btn-loading'); 1676 var autoplay = $(this).attr('data-video-module-autoplay') ? 1 : 0; 1677 1678 var link = $(this).attr('data-video-module'); 1679 if (link && link.match('/(youtube|youtu\.be|vimeo)/i')) { 1680 link = link + "?autoplay=" + autoplay; 1681 } 1682 1683 // Append video 1684 popupInner.append($(document.createElement("iframe")).attr({ 1685 'src': link, 1686 'allowfullscreen': 'true', 1687 'frameborder': '0' 1688 })); 1689 1690 setTimeout(function () { 1691 $('.clb-popup').removeClass('container-loading'); 1692 }, 1000) 1693 }); 1694 } 1695 1696 /* ## Product quickview */ 1697 1698 function handleQuickviewPopup(items) { 1699 var link; 1700 1701 if (items === undefined) { 1702 link = $('.quickview-link'); 1703 } else { 1704 link = items.find('.quickview-link'); 1705 } 1706 1707 link.on("click", function (event) { 1708 event.preventDefault 1709 Clb.containerLoading.removeClass('hidden'); 1710 handlePopup('.clb-popup.custom-popup'); 1711 var link = $(this); 1712 1713 $.ajax({ 1714 url: ohioVariables.url, 1715 data: { 1716 action: 'ohio_product_modal', 1717 product_id: $(this).attr('data-product-id'), 1718 }, 1719 dataType: 'html', 1720 type: 'POST', 1721 success: function (data) { 1722 var popupInner = $('.custom-popup .clb-popup-holder').addClass('clb-popup-product'); 1723 popupInner.siblings('.btn-loading-disabled').removeClass('btn-loading'); 1724 popupInner.append(data); 1725 1726 // Add link for title 1727 var productTitle = $('.clb-popup-product .woo_c-product-details-title'); 1728 var productLink = link.parent().find('.slider a'); 1729 1730 productTitle.wrap('<div class="product-popup-title-link"><a href=' + productLink.attr('href') + ' target="_blank"></a></div>'); 1731 1732 Clb.containerLoading.addClass('hidden'); 1733 btnPreloader(); 1734 handleCustomSelect(); 1735 setTimeout(function () { 1736 handleSingleProductGallery(popupInner.find('.woo_c-product'), popupInner.find('.post-' + link.attr('data-product-id') + '')); 1737 }, 50); 1738 1739 popupInner.find('.woo_c-product-details-variations').wc_variation_form(); 1740 } 1741 }); 1742 }); 1743 } 1744 1745 // function popup_counter(event) { 1746 // var element = event.target; 1747 // var items = event.item.count; 1748 // var item = event.item.index + 1; 1749 // $('.numbers_slides').html(item + " / " + items) 1750 // } 1751 1752 /* # Portfolio */ 1753 1754 function handlePortfolio() { 1755 // Filter
1756 $('[data-ohio-portfolio-grid]').each(function () { 1757 var portfolioGrid = $(this); 1758 var isotopeGrid = $(this).find('[data-isotope-grid]'); 1759 var filterbar = $(this).find('[data-filter="portfolio"]'); 1760 var gridItem = portfolioGrid.find('.grid-item:not(.double-width)'); 1761 var itemWidth = (gridItem.length) ? gridItem[0].getBoundingClientRect().width : 0; 1762 1763 if (isotopeGrid.isotope) { 1764 setTimeout(function () { 1765 if (portfolioGrid.find('.grid-item').length == portfolioGrid.find('.double-width').length) { 1766 isotopeGrid.isotope({ 1767 percentPosition: true, 1768 masonry: { 1769 columnWidth: '.grid-item' 1770 } 1771 }); 1772 } else { 1773 isotopeGrid.isotope({ 1774 percentPosition: true, 1775 masonry: { 1776 columnWidth: '.grid-item:not(.double-width)' 1777 } 1778 }); 1779 } 1780 }, 10); 1781 1782 } else { 1783 console.log('Isotope Grid is undefined'); 1784 } 1785 1786 // Generate category numbers 1787 if (filterbar.attr('data-filter-paged')) { 1788 filterbar.find('a').each(function () { 1789 var category = $(this).attr('data-isotope-filter'); 1790 1791 var number = (category == '*') ? isotopeGrid.find('> div').length : isotopeGrid.find(category).length; 1792 1793 if (number < 10) { 1794 number = '0' + number; 1795 } 1796 1797 $(this).find('.num').html(number); 1798 }); 1799 } 1800 1801 filterbar.find('a').on('click', function () { 1802 filterbar.find('.active').removeClass('active'); 1803 $(this).addClass('active'); 1804 1805 if (isotopeGrid.isotope) { 1806 isotopeGrid.isotope({ 1807 filter: $(this).attr('data-isotope-filter'), 1808 masonry: { 1809 percentPosition: true, 1810 columnWidth: itemWidth, 1811 itemSelector: '.grid-item:not(.double-width)', 1812 } 1813 }); 1814 } 1815 1816 setTimeout(function () { 1817 if (typeof (AOS) != 'undefined') { 1818 AOS.refresh(); 1819 } 1820 if (window.vc_waypoints) { 1821 window.vc_waypoints(); 1822 } 1823 if (portfolioGrid.find('.lazy-load').length) { 1824 if (isFilterItemsHidden(portfolioGrid)) { 1825 lazyLoad($('[data-lazy-load]')); 1826 } 1827 } 1828 }, 600); 1829 portfolioGridType12(); 1830 return false; 1831 }); 1832 1833 $('body').on('ohio:lazy_load_complete', function () { 1834 portfolioGrid.find('.lazy-load').removeClass('is-loading'); 1835 portfolioGrid.find('.portfolio-grid').removeClass('is-loading'); 1836 }); 1837 1838 if (window.location.hash) { 1839 filterbar.find('a[href="' + window.location.hash + '"]').trigger('click'); 1840 } 1841 }); 1842 } 1843 1844 function isFilterItemsHidden(portfolioGrid) { 1845 var isHidden = false; 1846 var counter = 0; 1847 var itemsPerPage = $("[data-projects-per-page]").data('projects-per-page'); 1848 var categoryCount = portfolioGrid.find('[data-category-count].active').data('category-count'); 1849 var lazyLoadPagination = portfolioGrid.find(".lazy-load"); 1850 lazyLoadPagination.addClass('is-loading'); 1851 portfolioGrid.find('.portfolio-grid').addClass('is-loading'); 1852 1853 $('[data-ohio-portfolio-grid]').each(function () { 1854 var gridItems = $(this).find('[data-filter="portfolio"]').next().find(".grid-item"); 1855 1856 gridItems.each(function () { 1857 console.log(portfolioGrid.find('[data-category-count].active')) 1858 if ($(this)[0].style.display == "none") { 1859 isHidden = true; 1860 } else { 1861 counter++; 1862 1863 if (counter >= itemsPerPage || counter == categoryCount) { 1864 isHidden = false;
1865 lazyLoadPagination.removeClass('is-loading'); 1866 portfolioGrid.find('.portfolio-grid').removeClass('is-loading'); 1867 return isHidden; 1868 } 1869 } 1870 }); 1871 }); 1872 1873 return isHidden; 1874 } 1875 1876 $(window).on('ohio:handle_portfolio', handlePortfolio); 1877 1878 function handlePortfolioPopup() { 1879 var portfolioPopupSlider = $('.clb-portfolio-lightbox-media .slider'); 1880 1881 var loopSetting = Boolean(portfolioPopupSlider.attr('data-slider-loop')), 1882 navSetting = Boolean(portfolioPopupSlider.attr('data-slider-navigation')), 1883 bulletsSetting = Boolean(portfolioPopupSlider.attr('data-slider-dots')), 1884 paginationSetting = Boolean(portfolioPopupSlider.attr('data-slider-pagination')), 1885 mousescrollSetting = Boolean(portfolioPopupSlider.attr('data-slider-mousescroll')), 1886 autoplaySetting = Boolean(portfolioPopupSlider.attr('data-slider-autoplay')), 1887 autoplayTimeSetting = portfolioPopupSlider.attr('data-slider-autoplay-time'); 1888 1889 1890 $('[data-clb-portfolio-lightbox-slider]').each(function () { 1891 if (!$(this).hasClass('clb-slider')) { 1892 $(this).clbSlider({ 1893 dots: bulletsSetting, 1894 pagination: paginationSetting, 1895 mousewheel: mousescrollSetting, 1896 autoplay: autoplaySetting, 1897 autoplayTimeout: autoplayTimeSetting, 1898 loop: loopSetting, 1899 navBtn: navSetting, 1900 drag: true, 1901 }); 1902 } 1903 }); 1904 1905 portfolioPopupSlider.find('.clb-slider-nav-btn .btn-round').removeClass('btn-round-light'); 1906 1907 $('.btn-lightbox, .btn-lightbox-init').on('click', function (e) { 1908 e.preventDefault(); 1909 var portfolioItemId = $(this).parents('.portfolio-item').attr('data-portfolio-popup'); 1910 1911 if (portfolioItemId != undefined) { 1912 loadLightboxGallery.call(document.querySelector('#' + portfolioItemId)); 1913 handlePopup('#' + portfolioItemId); 1914 } 1915 1916 }); 1917 } 1918 $(window).on('ohio:handle_portfolio_popup', handlePortfolioPopup); 1919 1920 function loadLightboxGallery() { 1921 if (!this.getAttribute('data-lightbox-loaded')) { 1922 var self = this; 1923 var stage = self.querySelector('.clb-portfolio-lightbox-media'); 1924 var loaded = 0; 1925 1926 stage.classList.add('container-loading'); 1927 1928 $(this).find('[data-ohio-lightbox-image]').each(function () { 1929 var originalImage = this; 1930 var image = new Image(); 1931 image.src = originalImage.getAttribute('data-ohio-lightbox-image'); 1932 image.onload = function () { 1933 originalImage.style.backgroundImage = "url(" + image.src + ")"; 1934 loaded++; 1935 1936 if (loaded === $(self).find('[data-ohio-lightbox-image]').length) { 1937 stage.classList.remove('container-loading'); 1938 self.setAttribute('data-lightbox-loaded', true); 1939 } 1940 } 1941 }); 1942 } 1943 } 1944 1945 /* ## Scroll content */ 1946 function handleScrollContent() { 1947 $('[data-ohio-content-scroll]').each(function () { 1948 var content = $(this), 1949 parent = $($(this).attr('data-ohio-content-scroll')), 1950 timeout = null, startTop = 0, 1951 contentLeft = 0, 1952 minWidth = 768, 1953 header = $('#masthead[data-header-fixed]'), 1954 subheader = $('.subheader'), 1955 wpadminbar = $('#wpadminbar'), 1956 headerSpacer = $('.full-top-position').length ? 130 : 0; 1957 var refresh = function () { 1958 var scrollTop = $(window).scrollTop(); 1959 1960 if (header.length) { 1961 scrollTop += header.outerHeight(); 1962 1963 if (subheader.length) { 1964 scrollTop += subheader.outerHeight(); 1965 } 1966 } 1967 1968 if ($('#wpadminbar').length) { 1969 scrollTop += $('#wpadminbar').outerHeight(); 1970 } 1971 1972 if ($(window).width() >= minWidth && content.outerHeight() < parent.outerHeight()) { 1973 // scroll start 1974 1975 if (scrollTop > startTop) { 1976 var headerTop = 0; 1977 if (header.length) { 1978 headerTop += header.outerHeight(); 1979 1980 if (subheader.length) { 1981 headerTop += subheader.outerHeight(); 1982 } 1983 } 1984 1985 if ($('#wpadminbar').length) { 1986 headerTop += $('#wpadminbar').outerHeight(); 1987 } 1988 content.css({ 1989 'max-width': (content.outerWidth()) + 'px', 1990 'position': 'fixed', 1991 'top': headerTop + 'px', 1992 'left': contentLeft + 'px' 1993 }); 1994 } else { 1995 content.css({ 1996 'max-width': 'none', 1997 'position': 'relative', 1998 'top': '0px', 1999 'left': '0px' 2000 }); 2001 } 2002 // scroll end 2003 if (scrollTop + content.outerHeight() > parent.offset().top + parent.outerHeight()) { 2004 var top = parent.outerHeight() - content.outerHeight() - headerSpacer; 2005 2006 content.css({ 2007 'max-width': 'none', 2008 'position': 'relative', 2009 'top': (top) + 'px', 2010 'left': '0' + 'px' 2011 }); 2012 } 2013 } else { 2014 content.css({ 2015 'max-width': 'none', 2016 'position': 'relative', 2017 'top': '0px', 2018 'left': '0px' 2019 }); 2020 } 2021 }; 2022 2023 var resize = function () { 2024 content.css('position', 'static'); 2025 2026 contentLeft = content.offset().left; 2027 startTop = content.offset().top; 2028 2029 clearTimeout(timeout); 2030 timeout = setTimeout(function () { 2031 content.css({ 2032 'position': 'absolute', 2033 'top': (content.offset().top - parent.offset().top) + 'px', 2034 'left': (content.offset().left - parent.offset().left) + 'px' 2035 }); 2036 refresh(); 2037 }, 30); 2038 }; 2039 2040 setTimeout(function () { resize(); }, 100); 2041 2042 if (content.data('ohio-content-scroll') == '#checkout-content-scroll') { 2043 2044 $('.checkout').on('checkout_place_order', function () { 2045 setTimeout(function () { 2046 resize(); 2047 }, 2000); 2048 }); 2049 2050 $(window).on('scroll', refresh); 2051 2052 } else { 2053 $(window).on('scroll', refresh); 2054 } 2055 2056 var windowWidth = $(window).width(); 2057 $(window).on('resize', function () { 2058
2059 if (!$('.woo_c-product.single-product').length) { 2060 resize(); 2061 } else { 2062 if (windowWidth != $(window).width()) { 2063 resize(); 2064 windowWidth = $(window).width(); 2065 } 2066 } 2067 }); 2068 }); 2069 } 2070 2071 // ## Shop masonry 2072 2073 function handleShopMasonry() { 2074 var shopMasonry = $('[data-shop-masonry]'); 2075 if (!Clb.isElementorPage) { 2076 shopMasonry.each(function () { 2077 2078 var product = $(this).find('> li.product'); 2079 2080 if (shopMasonry && !shopMasonry.parents('.shop-product-type_3').length && product.length > 1) { 2081 shopMasonry.masonry({ 2082 percentPosition: true, 2083 columnWidth: ' .product:not(.double_width)' 2084 }); 2085 } 2086 }) 2087 } 2088 } 2089 2090 /* # Product */ 2091 2092 /* ## Ajax cart */ 2093 2094 jQuery(function ($) { 2095 2096 $(".input-text.qty.text").on('keyup mouseup', function () { 2097 var value = $(this).val(); 2098 $("#product_quantity").val(value) 2099 }); 2100 2101 $(document).on('click', '.single_add_to_cart_button', function (e) { 2102 if ($(this).hasClass('out_of_stock') || $(this).hasClass('product_type_variable') || $(this).closest('form').hasClass('external-product') || $(this).hasClass('product_type_external') || (!$(this).hasClass('single_add_to_cart_button') && $(this).parents('ul.products'))) return; 2103 2104 e.preventDefault(); 2105 2106 var $variation_form = $(this).closest('.variations_form'); 2107 2108 if (!$variation_form.length) { 2109 $variation_form = $('.variations_form'); 2110 } 2111 2112 var var_id = $variation_form.find('input[name=variation_id]').val(); 2113 var product_id = $variation_form.find('input[name=product_id]').val(); 2114 var quantity = $variation_form.find('input[name=quantity]').val(); 2115 2116 $('.ajaxerrors').remove(); 2117 var item = {}, 2118 check = true; 2119 var variations = $variation_form.find('select[name^=attribute]'); 2120 if (!variations.length) { 2121 variations = $variation_form.find('[name^=attribute]:checked'); 2122 } 2123 if (!variations.length) { 2124 variations = $variation_form.find('input[name^=attribute]'); 2125 } 2126 2127 variations.each(function () { 2128 var $this = $(this), 2129 attributeName = $this.attr('name'), 2130 attributevalue = $this.val(), 2131 index, 2132 attributeTaxName; 2133 $this.removeClass('error'); 2134 2135 if (attributevalue.length === 0) { 2136 index = attributeName.lastIndexOf('_'); 2137 attributeTaxName = attributeName.substring(index + 1); 2138 $this.addClass('required error'); 2139 2140 if (!$this.parent().find('.please-select-message').length) { 2141 $this.before('<span class="please-select-message">' + $variation_form.data('please-select-message') + ' ' + attributeTaxName + '</span>') 2142 } 2143 2144 check = false; 2145 } else { 2146 item[attributeName] = attributevalue; 2147 } 2148 }); 2149 2150 if (!check) { 2151 if ($(this).hasClass('sticky-product-cart')) { 2152 $(this).removeClass('btn-loading'); 2153 alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text); 2154 } 2155 2156 return false; 2157 } 2158 2159 var $thisbutton = $(this); 2160 2161 if ($thisbutton.is('.single_add_to_cart_button')) { 2162 $thisbutton.removeClass('added'); 2163 $thisbutton.addClass('loading'); 2164 // if ($thisbutton.parents(".variations_form")[0]) { 2165 // var product_id = $variation_form.find('input[name=product_id]').val(); 2166 // var quantity = $variation_form.find('input[name=quantity]').val(); 2167 // var data = { 2168 // action: 'ohio_ajax_add_to_cart_woo', 2169 // product_id: product_id, 2170 // quantity: quantity, 2171 // variation_id: var_id, 2172 // variation: item 2173 // }; 2174 // } else {
2175 // if ($thisbutton.closest('.woocommerce-add-to-cart').length > 0) { 2176 // var product_id = $thisbutton.closest('.woocommerce-add-to-cart').find("input[name=product_id]").val(); 2177 // var quantity = $thisbutton.closest('.woocommerce-add-to-cart').find("input[name=quantity]").val(); 2178 // var data = { 2179 // action: 'ohio_ajax_add_to_cart_woo_single', 2180 // product_id: product_id, 2181 // quantity: quantity 2182 // }; 2183 // } else { 2184 // var product_id = $thisbutton.siblings("input[name=product_id]").val(); 2185 // var data = { 2186 // action: 'ohio_ajax_add_to_cart_woo_single', 2187 // product_id: product_id, 2188 // quantity: 1 2189 // }; 2190 // } 2191 // } 2192 2193 if ($('form.cart').hasClass('woo_c-cart-form')) { 2194 var serializeFormFields = $('form.cart').serializeArray(); 2195 2196 var data = {}; 2197 $(serializeFormFields).each(function (index, obj) { 2198 data[obj.name] = obj.value; 2199 }); 2200 2201 data.action = 'ohio_ajax_add_to_cart_woo'; 2202 2203 if ($thisbutton.is('.sticky-product-cart')) { 2204 if ($('.single_variation_wrap').length && $('.single_variation_wrap').find('.single_add_to_cart_button.wc-variation-is-unavailable').length) { 2205 alert($thisbutton.data('unavailable-message')); 2206 $thisbutton.removeClass('btn-loading loading'); 2207 } 2208 } 2209 } else if ($thisbutton.parents('.product-buttons-item').length) { 2210 2211 var product_id = $thisbutton.siblings("input[name=product_id]").val(); 2212 var data = { 2213 action: 'ohio_ajax_add_to_cart_woo_single', 2214 product_id: product_id, 2215 quantity: 1 2216 }; 2217 } else { 2218 2219 var serializeFormFields = $('form.cart').serializeArray(); 2220 var data = {}; 2221 var prevObj; 2222 2223 $(serializeFormFields).each(function (index, obj) { 2224 2225 if (obj.name == prevObj) { 2226 obj.index = index; 2227 } 2228 2229 prevObj = obj.name 2230 }); 2231 2232 $(serializeFormFields).each(function (index, obj) { 2233 2234 if (obj.index) { 2235 obj.name = obj.name + "-" + obj.index; 2236 } 2237 data[obj.name] = obj.value; 2238 }); 2239 2240 if (data['product_id'] == undefined) { 2241 data['product_id'] = data['add-to-cart']; 2242 } 2243 2244 delete data['add-to-cart']; 2245 2246 data.action = 'ohio_ajax_add_to_cart_woo'; 2247 } 2248 2249 2250 2251 2252 $('body').trigger('adding_to_cart', [$thisbutton, data]); 2253 $.post(wc_cart_fragments_params.ajax_url, data, function (response) { 2254 if (!response) 2255 return; 2256 2257 var this_page = window.location.toString(); 2258 this_page = this_page.replace('add-to-cart', 'added-to-cart'); 2259 if (response.error && response.product_url) { 2260 2261 window.location = response.product_url; 2262 return; 2263 } 2264 2265 if (window.wc_add_to_cart_params && window.wc_add_to_cart_params.cart_redirect_after_add == 'yes') { 2266 window.location = wc_add_to_cart_params.cart_url; 2267 return; 2268 } else { 2269 $thisbutton.removeClass('loading'); 2270 var fragments = response.fragments; 2271 var cart_hash = response.cart_hash; 2272 if (fragments) { 2273 $.each(fragments, function (key) { 2274 $(key).addClass('updating'); 2275 }); 2276 } 2277 $('.shop_table.cart, .updating, .cart_totals').fadeTo('400', '0.6').block({ 2278 message: null, 2279 overlayCSS: { 2280 opacity: 0.6 2281 } 2282 }); 2283 $thisbutton.addClass('added'); 2284 $thisbutton.text('Product Added'); 2285 2286 var $classes = ''; 2287 if (($('body').hasClass('single-product') || $thisbutton.parents('.clb-popup').length) && !$thisbutton.hasClass('sticky-product-cart')) { 2288 $classes = ' btn btn-small view-cart'; 2289 } else if ($thisbutton.hasClass('sticky-product-cart')) { 2290 $classes = $classes + ' btn btn-link view-cart'; 2291 } else { 2292 $classes = $classes + ' btn btn-small view-cart'; 2293 } 2294 2295 $thisbutton.after('<a href="' + ohioVariables.cart_page + '" class="' + $classes + '">' + ohioVariables.view_cart + '</a>'); 2296 $thisbutton.css('display', 'none'); 2297 2298 if (fragments) { 2299 $.each(fragments, function (key, value) { 2300 $(key).replaceWith(value); 2301 }); 2302 } 2303 2304 $('.widget_shopping_cart, .updating').stop(true).css('opacity', '1').unblock(); 2305 $('.shop_table.cart').on('load', this_page + ' .shop_table.cart:eq(0) > *', function () { 2306 $('.shop_table.cart').stop(true).css('opacity', '1').unblock(); 2307 $(document.body).trigger('cart_page_refreshed'); 2308 }); 2309 $('.cart_totals').on('load', this_page + ' .cart_totals:eq(0) > *', function () { 2310 $('.cart_totals').stop(true).css('opacity', '1').unblock(); 2311 }); 2312 2313 var productName = ''; 2314 if ($thisbutton.closest('.product').find('h1').length > 0) { 2315 productName = $thisbutton.closest('.product').find('h1').text(); 2316 } else { 2317 productName = $thisbutton.closest('.product').find('.product-item-title').text(); 2318 } 2319 if (productName == '') { 2320 productName = $thisbutton.closest('.clb-popup-product').find('h1').text(); 2321 } 2322 $('footer').before('<div class="woo_c-message-group"><div class="ajax-cart-response message-box success">' + productName + ' ' + ohioVariables.add_to_cart_message + '<a class="view_cart_button" href="' + ohioVariables.cart_page + '">' + ohioVariables.view_cart + '</a><div class="btn-round btn-round-small btn-round-light clb-close dark-mode-reset" tabindex="0"><i class="ion ion-md-close"></i></div></div></div>'); 2323 } 2324 }); 2325 return false;
2326 } else { 2327 return true; 2328 } 2329 }); 2330 }); 2331 2332 /* # Lazy load */ 2333 2334 function lazyLoad(elem) { 2335 if (elem.data('lazy-load-loading')) { 2336 return; 2337 } 2338 2339 // Init 2340 elem.data('isLoaded', false); 2341 elem.data('lazy-load-loading', 'true').addClass('active'); 2342 2343 let currentPage = elem.data('lazy-page') ? parseInt(elem.data('lazy-page')) : 1; 2344 currentPage += 1; 2345 2346 elem.data('lazy-page', currentPage); 2347 2348 // Prepare request data 2349 let requestURL = ''; 2350 let data = false; 2351 2352 if (!elem.data('lazy-load-shortcode')) { 2353 let urlPattern = elem.data('lazy-load-url-pattern'); 2354 if (urlPattern) { 2355 requestURL = urlPattern.replace('{{page}}', currentPage); 2356 } else { 2357 requestURL = 'page/' + currentPage; 2358 } 2359 } else { 2360 data = { 2361 shortcode: elem.data('lazy-load-shortcode'), 2362 paged: currentPage, 2363 action: 'ohio_lazy_load_shortcodes' 2364 }; 2365 requestURL = elem.data('lazy-load-rest'); 2366 } 2367 2368 let scopeSlug = elem.data('lazy-load-scope'); 2369 2370 // Get page content 2371 $.ajax({ 2372 url: requestURL, 2373 data: data, 2374 method: (data) ? 'POST' : 'GET', 2375 success: function (content) { 2376 var dom = $(new DOMParser().parseFromString(content, 'text/html')); 2377 var items = dom.find('[data-lazy-item][data-lazy-scope="' + scopeSlug + '"]'); 2378 2379 var container = elem.parent().find('[data-lazy-container="' + scopeSlug + '"]'); 2380 if (container.length == 0) { 2381 container = $('[data-lazy-container="' + scopeSlug + '"]'); 2382 } 2383 items.parent().find('[data-aos]').attr('data-aos-offset', '20000000'); 2384 items.addClass('hidden'); 2385 2386 container.append(items); 2387 $(document.body).append(dom.find('[data-lazy-to-footer]')); 2388 2389 // Check images is loaded 2390 var metroImages = []; 2391 items.find('[data-ohio-bg-image]').each(function () { 2392 var img = document.createElement('img'); 2393 img.src = $(this).attr('data-ohio-bg-image'); 2394 metroImages.push(img); 2395 }); 2396 var checkImages = function () { 2397 var result = true, result2 = true; 2398 2399 items.find('img').removeAttr('loading').each(function () { 2400 if (!this.complete) { 2401 result = false;
2402 $(this).on('load', checkImages); 2403 return false; 2404 } 2405 }); 2406 2407 if (result) { 2408 for (var i = 0; i < metroImages.length; i++) { 2409 if (!metroImages[i].complete) { 2410 result2 = false; 2411 metroImages[i].onload = checkImages; 2412 return false; 2413 } 2414 } 2415 } 2416 2417 if (result && result2) { 2418 items.removeClass('hidden'); 2419 handlePortfolioPopup(); 2420 handlePortfolio(); 2421 handleQuickviewPopup(items); 2422 2423 var portfolio_data_grid = container.hasClass('portfolio-grid') && container.isotope; 2424 var woo_data_grid = container.attr('data-shop-masonry') && container.isotope; 2425 2426 if (portfolio_data_grid || woo_data_grid) { 2427 container.isotope() 2428 .isotope('appended', items) 2429 .isotope('layout'); 2430 } 2431 2432 if (container.hasClass('ohio-masonry') || container.hasClass('masonry')) { 2433 container.masonry('appended', items, false); 2434 } 2435 2436 items.parent().find('[data-aos]').attr('data-aos-offset', ''); 2437 2438 if (typeof (AOS) != 'undefined') { 2439 // For mobile phones 2440 AOS.init(); 2441 2442 AOS.refresh(); 2443 } 2444 2445 handleOhioBgImages(); 2446 2447 if (currentPage >= parseInt(elem.attr('data-lazy-pages-count'))) { 2448 elem.remove(); 2449 $('body').trigger('ohio:lazy_load_complete'); 2450 $('body').trigger('ohio:cursor_mouseleave'); 2451 } else { 2452 // Wait height animation 2453 elem.removeClass('active'); 2454 if (elem.attr('data-lazy-load') == 'scroll') { 2455 setTimeout(function () { 2456 elem.removeData('lazy-load-loading'); 2457 handleLazyLoadScroll(); 2458 }, 500); 2459 } else { 2460 elem.removeData('lazy-load-loading'); 2461 } 2462 } 2463 } 2464 }; 2465 checkImages(); 2466 2467 handleInteractiveLinksGrid(); 2468 handleMasonry(); 2469 handlePortfolioMovingDetailsGrid(); 2470 setTimeout(function () { 2471 portfolioGridType12(); 2472 }, 100) 2473 2474 2475 elem.data('isLoaded', true); 2476 } 2477 }); 2478 } 2479 2480 function handleLazyLoadScroll() { 2481 $('[data-lazy-load="scroll"]').each(function () { 2482 if ($(document).scrollTop() + $(window).height() > $(this).offset().top) { 2483 lazyLoad($(this)); 2484 } 2485 }); 2486 } 2487 2488 function handleLazyLoadClick() { 2489 $('[data-lazy-load="click"]').on('click', function () { 2490 lazyLoad($(this)); 2491 }); 2492 } 2493 2494 function handleAOS() { 2495 if (typeof (AOS) != 'undefined') { 2496 setTimeout(function () { 2497 AOS.init(); 2498 }, 600); 2499 } 2500 } 2501 2502 function handleStretchContent() { 2503 if (!$('.page-sidebar').length) { 2504 2505 $('[data-vc-stretch-content="true"], [data-vc-full-width="true"], [data-ohio-stretch-content="true"], .alignfull').each(function () { 2506 if (Clb.isRtl) { 2507 $(this).css('right', '0'); 2508 2509 $(this).css({ 2510 'width': $('#page').width() + 'px', 2511 'right': ($('#page').offset().left - $(this).offset().left) + 'px' 2512 }); 2513 } else { 2514 $(this).css('left', '0'); 2515 2516 $(this).css({ 2517 'width': $('#page').width() + 'px', 2518 'left': ($('#page').offset().left - $(this).offset().left) + 'px' 2519 }); 2520 } 2521 2522 setTimeout(function () { 2523 handleAccordionBoxSize(); 2524 }, 10); 2525 2526 }); 2527 2528 $('[data-vc-full-width="true"]').not('[data-vc-stretch-content="true"]').each(function () { 2529 if (!Clb.header || !Clb.header.length) { 2530 return; 2531 } 2532 2533 var padding = ($('#page').outerWidth() - $(this).closest('.page-container').outerWidth()) / 2; 2534 if (!Clb.isMobile) { 2535 padding = padding + 10; 2536 } 2537 2538 if (Clb.header.hasClass('header-6') || Clb.header.hasClass('header-7')) { 2539 if ($(this).parents('.single-product-tabs').length) { 2540 $(this).css({ 2541 'padding-left': padding + 'px', 2542 'padding-right': padding + 90 + 'px', 2543 }); 2544 } 2545 } else { 2546 if ($(this).parents('.single-product-tabs').length) { 2547 $(this).css({ 2548 'padding-left': padding + 'px', 2549 'padding-right': padding + 'px', 2550 }); 2551 } 2552 } 2553 2554 }); 2555 2556 $('.rev_slider_wrapper.fullwidthbanner-container, .rev_slider_wrapper.fullscreen-container').each(function () { 2557 $(this).css('padding-left', $('#page').offset().left + 'px'); 2558 }); 2559 2560 setTimeout(function () { 2561 var revSliders = $('.rev_slider'); 2562 if (revSliders.revredraw) { 2563 revSliders.revredraw(); 2564 } 2565 }, 30); 2566 } 2567 } 2568 2569 window.ohioRowRefresh = handleStretchContent; 2570 2571 function handleScrollEffects() { 2572 $('[data-ohio-scroll-anim]').each(function () { 2573 var anim = $(this).attr('data-ohio-scroll-anim'); 2574 2575 if ($(this).offset().top < ($(window).scrollTop() + $(window).height() - 50)) { 2576 $(this).removeClass(anim).removeAttr('data-ohio-scroll-anim'); 2577 } 2578 }); 2579 } 2580 2581 function handleOhioHeight() { 2582 var windowHeight = $(window).height(); 2583 var footerHeight = $('.site-footer').outerHeight(); 2584 var headerCapHeight = ($('.header-cap').length) ? $('.header-cap').outerHeight() : 0; 2585 var wpAdminHeight = ($('#wpadminbar').length) ? $('#wpadminbar').outerHeight() : 0; 2586 var headerTitleHeight = ($('.clb-page-headline').length) ? $('.clb-page-headline').outerHeight() : 0; 2587 2588 $('[data-ohio-full-height]').each(function () { 2589 var height = windowHeight - footerHeight - headerCapHeight - wpAdminHeight - headerTitleHeight; 2590 2591 $(this).css('height', (height) + 'px'); 2592 }); 2593 } 2594 2595 function handleAlignContentInStretchRow() { 2596 var containerWidth = $('#content').outerWidth(); 2597 var halfContainer = containerWidth / 2 - $('#content .page-container').width() / 2; 2598 2599 // Align content column in wrapper container 2600 var align = function (self, isSplitbox, isParallax, isRight, innerSection) { 2601 if (innerSection) { 2602 var column = self.find('> .wpb_column > .vc_column-inner, > .elementor-container > .elementor-row > .elementor-column > .elementor-column-wrap .elementor-widget-wrap, > .elementor-container > .elementor-column > .elementor-widget-wrap'); 2603 } else { 2604 var column = self.find('> .wpb_column, > .elementor-container > .elementor-row > .elementor-column > .elementor-column-wrap .elementor-widget-wrap, > .elementor-container > .elementor-column > .elementor-widget-wrap'); 2605 } 2606 2607 if (isSplitbox) { 2608 column = self.find('> .split-box-container'); 2609 } 2610 if (isParallax) { 2611 column = self.find('> .parallax-content'); 2612 }
2613 column = (isRight) ? column.last() : column.eq(0); 2614 2615 if (!Clb.isMobile) { 2616 column.css('padding-' + (isRight ? 'right' : 'left'), (halfContainer) + 'px'); 2617 } else { 2618 column.css('padding-' + (isRight ? 'right' : 'left'), ''); 2619 } 2620 }; 2621 2622 // Stretch column 2623 var stretch = function (self, isSplitbox, isRight, innerSection) { 2624 2625 if (innerSection) { 2626 var column = self.find(isSplitbox ? '> .split-box-container' : '> .wpb_column > .vc_column-inner, > .elementor-container > .elementor-row > .elementor-column > .elementor-column-wrap, > .elementor-container > .elementor-column > .elementor-widget-wrap'); 2627 } else { 2628 var column = self.find(isSplitbox ? '> .split-box-container' : '> .wpb_column > .vc_column-inner > .wpb_wrapper, > .elementor-container > .elementor-row > .elementor-column > .elementor-column-wrap, > .elementor-container > .elementor-column > .elementor-widget-wrap'); 2629 } 2630 column.css('min-width', ''); 2631 2632 column = (isRight) ? column.last() : column.eq(0); 2633 column.css({ 'position': '', 'left': '', 'width': '' }).addClass('stretch-content'); 2634 2635 if (column.length) { 2636 if (Clb.isRtl) { 2637 if( isRight ){ 2638 column.css( 'min-width', (containerWidth - (column.offset().left + column.outerWidth() )) + 'px'); 2639 } else { 2640 column.css({ 2641 'position': 'relative', 2642 'right': -(($(window).width() - (column.offset().left + column.outerWidth())) ) + 'px', 2643 'min-width': ( (column.outerWidth()) + ($(window).width() - (column.offset().left + column.outerWidth())) ) + 'px' 2644 }); 2645 } 2646 } else { 2647 if( isRight ){ 2648 column.css( 'min-width', (containerWidth - column.offset().left ) + 'px'); 2649 } else { 2650 column.css({ 2651 'position': 'relative', 2652 'left': -( column.offset().left) + 'px', 2653 'min-width': ( column.offset().left + column.outerWidth() ) + 'px' 2654 }); 2655 } 2656 } 2657 2658 if( Clb.isMobile ){ 2659 column.css({ 2660 'min-width': '', 2661 'left': '', 2662 'right': '' 2663 }); 2664 } 2665 } 2666 }; 2667 2668 $('.clb-column-padding-left').each(function () { 2669 align($(this), $(this).hasClass('split-box'), $(this).hasClass('parallax'), false, $(this).hasClass('inner')); 2670 }); 2671 2672 $('.clb-column-padding-right').each(function () { 2673 align($(this), $(this).hasClass('split-box'), $(this).hasClass('parallax'), true, $(this).hasClass('inner')); 2674 }); 2675 2676 $('.clb-stretch-column-left').each(function () { 2677 stretch($(this), $(this).hasClass('split-box'), false, $(this).hasClass('inner')); 2678 }); 2679 2680 $('.clb-stretch-column-right').each(function () { 2681 stretch($(this), $(this).hasClass('split-box'), true, $(this).hasClass('inner')); 2682 }); 2683 2684 2685 } 2686 2687 function boxedPageRowWidth() { 2688 var boxedPage = $('.boxed-container'); 2689 2690 if (boxedPage.length) { 2691 var boxedPageWidth = boxedPage.width(); 2692 var boxedContainerOffset = boxedPage.offset().left; 2693 var siteContentWidth = $('.site-content > .page-container').outerWidth(); 2694 var stretchRowPaddings; 2695 var rowOffset; 2696 $('[data-vc-full-width], .elementor-section-stretched').each(function () { 2697 2698 $(this).css({ 2699 'width': boxedPageWidth, 2700 'left': 'auto' 2701 }); 2702 2703 rowOffset = $(this).offset().left; 2704 $(this).css({ 2705 'left': (rowOffset - boxedContainerOffset) * -1 2706 }); 2707 2708 stretchRowPaddings = ($(this).outerWidth() - siteContentWidth) / 2; 2709 2710 if ($(this).hasClass('vc_row') && $(this).data('vc-full-width') && !$(this).data('vc-stretch-content')) { 2711 $(this).css({ 2712 'padding-left': stretchRowPaddings, 2713 'padding-right': stretchRowPaddings, 2714 }); 2715 } 2716 }); 2717 } 2718 } 2719 2720 function instagramFeedCustomCursor() { 2721 var instaFeed = $('#sb_instagram .sbi_item .sbi_photo_wrap'); 2722 2723 instaFeed.each(function () {
2724 $(this).attr('data-cursor-class', 'cursor-link'); 2725 }); 2726 } 2727 2728 function handleMutationObserver() { 2729 var target = $('#sb_instagram #sbi_images, #order_review, .portfolio-grid, [data-lazy-load-scope="projects"]'); 2730 if (target != undefined) { 2731 target.each(function () { 2732 var target = this; 2733 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 2734 var observer = new MutationObserver(function (mutations) { 2735 mutations.forEach(function (mutation) { 2736 if ($(target).attr('id') == 'sbi_images') { 2737 if (mutation.addedNodes.length) { 2738 instagramFeedCustomCursor(); 2739 observer.disconnect(); //Can disconect whole function 'handleMutationObserver' 2740 } 2741 } 2742 2743 if ($(target).attr('id') == 'order_review') { 2744 if (mutation.addedNodes.length) { 2745 btnPreloader(); 2746 observer.disconnect(); //Can disconect whole function 'handleMutationObserver' 2747 } 2748 } 2749 2750 if ($(target).hasClass('lazy-load')) { 2751 2752 if (mutation.oldValue.indexOf('active') != -1) { 2753 if ($(target).data('isLoaded')) { 2754 2755 var portfolioGrid = $(target).parent(); 2756 if (portfolioGrid.find('.portfolio-sorting').length) { 2757 setTimeout(function () { 2758 if (isFilterItemsHidden(portfolioGrid)) { 2759 lazyLoad($('[data-lazy-load]')); 2760 } 2761 }, 1000); 2762 } 2763 } 2764 } 2765 } 2766 }); 2767 }); 2768 2769 2770 // Settings observer 2771 var config = { 2772 attributes: true, 2773 characterData: true, 2774 childList: true, 2775 subtree: true, 2776 attributeOldValue: true, 2777 characterDataOldValue: true, 2778 } 2779 2780 // Start observer 2781 2782 observer.observe(this, config); 2783 2784 }); 2785 } 2786 } 2787 2788 $(document).on('click', '.search_results_btn', function () { 2789 $('.woocommerce-product-search').trigger('submit'); 2790 }); 2791 2792 // Search action to keyup 2793 $('.woocommerce-product-search input[name=s]').on("keyup", function (event) { 2794 if (!$('.woocommerce-product-search .search-submit').hasClass('btn-loading')) { 2795 $('.woocommerce-product-search .search-submit').addClass('btn-loading'); 2796 } 2797 2798 var form = $(this).closest('form'); 2799 var data = { 2800 'action': 'ohio_ajax_search', 2801 'search_query': $(this).val(), 2802 'search_term': $('select[name="search_term"]').val() 2803 }; 2804 2805 $.post(ohioVariables.url, data, function (response) { 2806 $('.search_results').empty(); 2807 $('.woocommerce-product-search .search-submit').removeClass('btn-loading'); 2808 $('.search_results').append(response); 2809 form.attr('action', $('#search_form_action').attr('data-href')); 2810 btnPreloader(); 2811 }); 2812 }); 2813 2814 // Search action to focus 2815 $('.woocommerce-product-search input[name=s]').on("focus", function (event) { 2816 2817 if ($('.search_results').children().length == 0) { 2818 if (!$('.woocommerce-product-search .search-submit').hasClass('btn-loading')) { 2819 $('.woocommerce-product-search .search-submit').addClass('btn-loading'); 2820 } 2821 2822 var form = $(this).closest('form'); 2823 var data = { 2824 'action': 'ohio_ajax_search', 2825 'search_query': $(this).val(), 2826 'search_term': $('select[name="search_term"]').val() 2827 }; 2828 2829 $.post(ohioVariables.url, data, function (response) { 2830 $('.search_results').empty(); 2831 $('.woocommerce-product-search .search-submit').removeClass('btn-loading'); 2832 $('.search_results').append(response); 2833 form.attr('action', $('#search_form_action').attr('data-href')); 2834 btnPreloader(); 2835 }); 2836 } 2837 }); 2838 2839 // Search action to select category
2840 $(document).on('change', '.woocommerce-product-search select', function () { 2841 if (!$('.woocommerce-product-search .search-submit').hasClass('btn-loading')) { 2842 $('.woocommerce-product-search .search-submit').addClass('btn-loading'); 2843 } 2844 2845 var form = $(this).closest('form'); 2846 var data = { 2847 'action': 'ohio_ajax_search', 2848 'search_query': $('input[name=s]').val(), 2849 'search_term': $('select[name="search_term"]').val() 2850 }; 2851 2852 $.post(ohioVariables.url, data, function (response) { 2853 $('.search_results').empty(); 2854 $('.woocommerce-product-search .search-submit').removeClass('btn-loading'); 2855 $('.search_results').append(response); 2856 form.attr('action', $('#search_form_action').attr('data-href')); 2857 }); 2858 }); 2859 2860 //Btn preloader 2861 function btnPreloader() { 2862 var buttons = $('.btn-loading-disabled'); 2863 2864 btnLoading(buttons); 2865 2866 function btnLoading(btn) { 2867 btn.each(function () { 2868 $(this).on('click', function () { 2869 2870 var form = $(this).parents('form'); 2871 var validation = true; 2872 2873 form.find('[required]').each(function() { 2874 if (!$(this).val()) { 2875 validation = false 2876 } 2877 }); 2878 2879 if (!($(this).hasClass('disabled')) && validation) { 2880 $(this).toggleClass('btn-loading'); 2881 $(this).find('i').hide(); 2882 } 2883 }); 2884 }); 2885 } 2886 } 2887 2888 /*Single product*/ 2889 2890 function handleSingleProductGallery(scrollContainer, product) { 2891 2892 if (scrollContainer === undefined) { 2893 var scrollContainer = $('body, html'); 2894 } 2895 2896 if (product === undefined) { 2897 var product = $('.woo_c-product.single-product'); 2898 } 2899 2900 var productImages = product.find('.woo_c-product-image .image-wrap img'); 2901 2902 if (productImages.length > 1 && !product.find('.product-image-dots').length) { 2903 2904 if (!product.parents('.clb-popup-product').length) { 2905 var data = 'data-ohio-content-scroll="#scroll-product"'; 2906 } 2907 2908 var productContainer = product.find('.woo_c-product-image').addClass('with-gallery'); 2909 2910 var imageDots = $('<div class="product-image-dots" ' + data + '></div>'); 2911 2912 imageDots.prependTo(productContainer); 2913 2914 productImages.each(function (i) { 2915 var clonedImg = $(this).clone(); 2916 var dotImage = $('<div class="product-image-dot" ></div>'); 2917 2918 clonedImg.appendTo(dotImage); 2919 dotImage.appendTo(imageDots); 2920 if (i == 0) { 2921 dotImage.addClass('active'); 2922 } 2923 }); 2924 2925 if (!product.parents('.clb-popup').length) { 2926 imageDots.css('height', imageDots.height()); 2927 } 2928 2929 2930 var productOffset = product.offset().top; 2931 var productImageSlider = product.find('.woo_c-product-image-slider'); 2932 2933 productImageSlider.css({ 2934 'width': productImageSlider.outerWidth() 2935 }); 2936 2937 var productImageDots = $('.product-image-dot'); 2938 2939 var imagesOffset = []; 2940 2941 if (product.parents('.clb-popup-product').length) { 2942 var sumHeight = 0; 2943 productImages.each(function () { 2944 var imgHeight = $(this).height(); 2945 imagesOffset.push(sumHeight); 2946 sumHeight += imgHeight; 2947 }); 2948 } else { 2949 productImages.each(function () { 2950 imagesOffset.push($(this).offset().top); 2951 }); 2952 } 2953 2954 //Slider 2955 var iteration = 0; 2956 2957 productImageDots.on('click', function () { 2958 $('.product-image-dot').removeClass('active'); 2959 $(this).addClass('active'); 2960 var index = $('.product-image-dot').index(this); 2961 iteration = index; 2962 var curentImage = $(productImages[index]); 2963 scrollContainer.animate({ 2964 scrollTop: imagesOffset[iteration] 2965 }, 500) 2966 }); 2967 2968 scrollContainer.on('scroll wheel', function (e) { 2969 var y = e.originalEvent.deltaY; 2970 2971 if (($(this).scrollTop() >= imagesOffset[iteration]) && y > 0) { 2972 productImageDots.removeClass('active'); 2973 $(productImageDots[iteration]).addClass('active'); 2974 iteration++; 2975 } 2976 else if (y < 0 && ($(this).scrollTop() >= imagesOffset[iteration - 1] && $(this).scrollTop() < imagesOffset[iteration])) { 2977 iteration--; 2978 productImageDots.removeClass('active'); 2979 $(productImageDots[iteration]).addClass('active'); 2980 } 2981 2982 if (iteration > productImages.length - 1 && y < 0) { 2983 iteration--; 2984 } 2985 }); 2986 } 2987 var singleProductGallery = $('.woocommerce-product-gallery'); 2988 2989 if (Clb.isPad) { 2990 singleProductGallery.clbSlider({ 2991 dots: false, 2992 drag: true, 2993 navBtn: true 2994 }); 2995 } else { 2996 setTimeout(function () { 2997 singleProductGallery.clbSlider('destroy'); 2998 }, 400); 2999 } 3000 } 3001 3002 //Sticky product 3003 3004 function handleStickyProduct() { 3005 var productImg = $('.woo_c-product-image'); 3006 var stickyProduct = $('.sticky-product'); 3007 var stickyProductImg = stickyProduct.find('.sticky-product-img'); 3008 var stickyProductNav = $('.sticky-nav-product'); 3009 3010 $(window).scroll(function () { 3011 if ($(window).scrollTop() > productImg.height()) { 3012 stickyProduct.addClass('visible'); 3013 stickyProductNav.addClass('invisible'); 3014 } else { 3015 stickyProduct.removeClass('visible'); 3016 stickyProductNav.removeClass('invisible'); 3017 } 3018 }); 3019 3020 if (Clb.isMobile) { 3021 var contentWidth = $('#content').height(); 3022 var contentOffset = $('#content').offset().top; 3023 var contentEnd = contentWidth + contentOffset - $(window).height(); 3024 3025 $(window).scroll(function () { 3026 if ($(window).scrollTop() > contentEnd) { 3027 stickyProduct.removeClass('visible'); 3028 } 3029 }); 3030 } 3031 3032 stickyProductImg.on("click", function () { 3033 $('body, html').animate({ scrollTop: 0 }, 500); 3034 }); 3035 3036 stickyProduct.find('.clb-close').on('click', function () { 3037 stickyProduct.removeClass('visible'); 3038 setTimeout(function () { 3039 stickyProduct.css('display', 'none'); 3040 }, 300); 3041 }); 3042 } 3043 /*language dropdown*/ 3044 3045 //*Hide empty language container* 3046 $(function () { 3047 var language = $('.header-wrap .right .languages'); 3048 3049 if (language.find('.sub-nav.languages').children().length == 0) { 3050 language.hide(); 3051 } 3052 }); 3053 3054 function centeredLogo() { 3055 /*header-4 centered logo*/ 3056 var header = $('.header-4'); 3057 var headerNav = header.find('.nav'); 3058 3059 //Menu-others have to be equal width 3060 header.find('.left-part, .right-part').css('width', menuOtherEqualWidth(header)); 3061 3062 var siteBrand = $('.branding'); 3063 var navMenu = $('#mega-menu-wrap').find('> ul:not(.mobile-menu) > li'); 3064 var logoWidth = siteBrand.outerWidth() - ($(window).width() * 0.0135); 3065 var centerLi = findCenterLi(navMenu); 3066 var firstMenuItemsWidth = 0; 3067 var menuLinkPadding = $(navMenu[centerLi]).find('> .menu-link').css('padding-left'); 3068 3069 navMenu.each(function (i) { 3070 if (i > centerLi) { 3071 return; 3072 } 3073 3074 firstMenuItemsWidth += $(this).width(); 3075 }); 3076 3077 headerNav.offset({ left: siteBrand.offset().left - firstMenuItemsWidth + (parseInt(menuLinkPadding) / 2) }); 3078 3079 $(navMenu[centerLi]).css('margin-right', logoWidth + "px"); 3080 3081 wideMenuOnResizePosition(); 3082 3083 setTimeout(function () { 3084 header.css('opacity', '1'); 3085 }, 500); 3086 3087 } 3088 3089 //Find center Li element 3090 function findCenterLi(menu) { 3091 if (menu.length % 2 == 0) { 3092 return Math.round((menu.length / 2) - 1); 3093 } 3094 else { 3095 return Math.round((menu.length / 2) - 2); 3096 } 3097 } 3098 3099 //Menu other equal width 3100 function menuOtherEqualWidth(header) { 3101 var menuOther = header.find('.left-part, .right-part'); 3102 var menuOtherWidth = 0; 3103 3104 menuOther.each(function () { 3105 if (menuOtherWidth < $(this).width()) { 3106 menuOtherWidth = $(this).width(); 3107 } 3108 }); 3109 3110 return menuOtherWidth + 1; 3111 } 3112 3113 /*Header 6*/ 3114 3115 $.each($('header.header-5'), function () {
3116 $(".menu-depth-1").removeClass('sub-menu-wide'); 3117 }); 3118 3119 /*Curency switcher*/ 3120 $('.currency_switcher').css('opacity', '1'); 3121 3122 /*Products grid*/ 3123 function handleProductsGridGallery() { 3124 var productSlider = $('.product-item-grid .slider'); 3125 3126 productSlider.each(function () { 3127 var slider = $(this); 3128 3129 if (Clb.isElementorPage) { 3130 slider.width(slider.width()); 3131 } 3132 3133 if (slider.find('img').length > 1) { 3134 slider.clbSlider({ 3135 dots: false, 3136 loop: true, 3137 //verticalScroll: true, 3138 navBtnClasses: 'btn-round-light btn-round-small' 3139 }); 3140 } 3141 }); 3142 3143 setTimeout(function () { 3144 handleShopMasonry(); 3145 }, 1000); 3146 } 3147 3148 // Logo overlay style 3149 3150 function logoOverlay() { 3151 var logoItems = $('.client-logo .client-logo-overlay'); 3152 3153 logoItems.each(function () { 3154 var logoDetails = $(this).find('.client-logo-details'); 3155 var logoDetailWidth = logoDetails.outerHeight(); 3156 3157 logoDetails.css({ 3158 'height': logoDetailWidth, 3159 'bottom': '-' + logoDetailWidth + 'px', 3160 }) 3161 }); 3162 } 3163 3164 // Product grid filter 3165 function handleMobileFilter() { 3166 var btn = $('.btn-filter a.btn'); 3167 var filter = $('.filter-holder .mbl-overlay'); 3168 var close = $('.clb-close, .mbl-overlay-bg'); 3169 3170 btn.on('click', function () { 3171 event.preventDefault(); 3172 handlePopup('.filter-holder .mbl-overlay'); 3173 }); 3174 close.on('click', function () { 3175 closePopup(filter) 3176 }); 3177 3178 $(document).on('keydown', function (e) { 3179 if (e.keyCode == 27) { 3180 closePopup(filter); 3181 } 3182 }); 3183 } 3184 3185 // Subscribe popup 3186 3187 function SubscribeModal() { 3188 3189 var data = { 3190 action: 'ohio_subscribe_modal' 3191 }; 3192 3193 jQuery.post(ohioVariables.url, data, function (data) { 3194 handlePopup('.clb-popup.custom-popup:not(.clb-gallery-lightbox)'); 3195 var popupInner = $('.custom-popup .clb-popup-holder'); 3196 popupInner.append(data); 3197 3198 var wpcf7_form = $('.wpcf7-form'); 3199 [].forEach.call(wpcf7_form, function (form) { 3200 wpcf7.init(form); 3201 handleSubscribeContactForm(); 3202 }); 3203 }); 3204 } 3205 3206 function handleSubscribeModal() { 3207 switch (ohioVariables.subscribe_popup_type) { 3208 case 'time': 3209 setTimeout(function () { 3210 SubscribeModal(); 3211 }, +ohioVariables.subscribe_popup_var * 1000); 3212 break; 3213 case 'scroll': 3214 var ckeck = true; 3215 $(window).on('scroll', function (e) { 3216 var scrollTop = $(window).scrollTop(); 3217 var docHeight = $(document).height(); 3218 var winHeight = $(window).height(); 3219 var scrollPercent = (scrollTop) / (docHeight - winHeight); 3220 var scrollPercentRounded = Math.round(scrollPercent * 100); 3221 if (ckeck && scrollPercentRounded > ohioVariables.subscribe_popup_var) { 3222 SubscribeModal(); 3223 ckeck = false; 3224 } 3225 }); 3226 break; 3227 case 'exit': 3228 var ckeck = true; 3229 $(document).on('mouseleave', function () { 3230 if (ckeck) { 3231 SubscribeModal(); 3232 ckeck = false; 3233 } 3234 }); 3235 break; 3236 } 3237 } 3238 3239 $('[href=\\#subscribe-init]').on('click', function (e) { 3240 e.preventDefault(); 3241 handlePopup('.clb-popup.custom-popup'); 3242 SubscribeModal(); 3243 }); 3244 3245 if (ohioVariables.subscribe_popup_enable && !getCookie('subscribeCookie')) { 3246 handleSubscribeModal(); 3247 } 3248 3249 3250 //Portfolio 3251 function handlePortfolioOnepageSlider() {
3252 var slider = $('[data-portfolio-grid-slider]'); 3253 var portfolio = $('.portfolio-item-fullscreen'); 3254 3255 var loopSetting = Boolean(slider.attr('data-slider-loop')), 3256 navSetting = Boolean(slider.attr('data-slider-navigation')), 3257 bulletsSetting = Boolean(slider.attr('data-slider-dots')), 3258 paginationSetting = Boolean(slider.attr('data-slider-pagination')), 3259 mousescrollSetting = Boolean(slider.attr('data-slider-mousescroll')), 3260 dragScrollSetting = Boolean(slider.attr('data-slider-dragcroll')), 3261 autoplaySetting = Boolean(slider.attr('data-slider-autoplay')), 3262 autoplayPauseSetting = Boolean(slider.attr('data-slider-autoplay-pause')), 3263 autoplayTimeSetting = slider.attr('data-slider-autoplay-time'); 3264 3265 slider.each(function () { 3266 var slider = $(this); 3267 3268 var sliderOffset = slider.offset().top; 3269 var sliderHeight = slider.height(); 3270 3271 if (slider.hasClass('grid_3') || slider.hasClass('grid_7') || slider.hasClass('project-fullscreen-slider')) { 3272 3273 slider.clbSlider({ 3274 items: 1, 3275 loop: loopSetting, 3276 mousewheel: mousescrollSetting, 3277 navBtn: navSetting, 3278 drag: dragScrollSetting, 3279 dots: bulletsSetting, 3280 pagination: paginationSetting, 3281 scrollToSlider: true, 3282 autoplay: autoplaySetting, 3283 autoplayTimeout: autoplayTimeSetting, 3284 autoplayHoverPause: true 3285 }); 3286 3287 fadeoutSliderItemAnimation(slider); 3288 removePerspectiveWhileScrolling(slider); 3289 } else if (slider.hasClass('grid_4')) { 3290 slider.clbSlider({ 3291 items: 1, 3292 loop: loopSetting, 3293 mousewheel: mousescrollSetting, 3294 navBtn: navSetting, 3295 drag: true, 3296 dots: false, 3297 pagination: paginationSetting, 3298 scrollToSlider: true, 3299 verticalScroll: true, 3300 autoplay: autoplaySetting, 3301 autoplayTimeout: autoplayTimeSetting, 3302 autoplayHoverPause: true 3303 }); 3304 3305 fadeoutSliderItemAnimation(slider); 3306 removePerspectiveWhileScrolling(slider); 3307 } else if (slider.hasClass('grid_6')) { 3308 const columns = slider.attr('data-slider-columns').split('-'); 3309 3310 slider.clbSlider({ 3311 items: +columns[0] || 3, 3312 loop: loopSetting, 3313 mousewheel: mousescrollSetting, 3314 navBtn: navSetting, 3315 drag: true, 3316 dots: false, 3317 pagination: paginationSetting, 3318 scrollToSlider: true, 3319 autoplay: autoplaySetting, 3320 autoplayTimeout: autoplayTimeSetting, 3321 autoplayHoverPause: true, 3322 responsive: { 3323 768: { 3324 items: +columns[2] || 1, 3325 }, 3326 1024: { 3327 items: +columns[1] || 2 3328 } 3329 } 3330 }); 3331 3332 fadeoutSliderItemAnimation(slider); 3333 removePerspectiveWhileScrolling(slider); 3334 } else if (slider.hasClass('grid_5') || slider.hasClass('grid_9') || slider.hasClass('grid_10')) { 3335 handleSmoothSlider(); 3336 } 3337 3338 if (slider.hasClass('grid_9')) { 3339 var nextProjectImg = $('.next-project-img-box'); 3340 3341 nextProjectImg.on('click', function () { 3342 $(this).trigger('prev-slide'); 3343 }); 3344 3345 $('.clb-scroll-top:not(.clb-slider-scroll-top)').hide(); 3346 } 3347 3348 if ($(window).scrollTop() > (sliderOffset + (sliderHeight / 2)) || $(window).scrollTop() < sliderOffset - (sliderHeight / 2)) { 3349 toggleSliderScrollBar('hide-all'); 3350 } 3351 3352 $(window).on('scroll', function () { 3353 if ($(window).scrollTop() >
3353 (sliderOffset + (sliderHeight / 2)) || $(window).scrollTop() < sliderOffset - (sliderHeight / 2)) { 3354 toggleSliderScrollBar('hide'); 3355 } else { 3356 toggleSliderScrollBar('show'); 3357 } 3358 }); 3359 3360 //Portfolio grid 3 overlay height 3361 if (!Clb.isMobile && (portfolio.hasClass('portfolio-grid-type-3') || portfolio.hasClass('portfolio-grid-type-6'))) { 3362 calcHeightForOnepageItemsOverlay(slider); 3363 } 3364 }); 3365 } 3366 $(window).on('ohio:handle_portfolio_onepage_slider', handlePortfolioOnepageSlider); 3367 3368 /*Onepage slider help functions*/ 3369 function calcHeightForOnepageItemsOverlay(slider) { 3370 3371 if (slider === undefined) { 3372 var slider = $('[data-portfolio-grid-slider]'); 3373 } 3374 3375 var overlay = slider.find('.portfolio-item-overlay'); 3376 var overlayHeight = 0; 3377 var height = 0; 3378 3379 overlay.each(function () { 3380 height = $(this).height() 3381 if (overlayHeight < height) { 3382 overlayHeight = height; 3383 } 3384 }); 3385 if (!Clb.isMobile) { 3386 overlay.css('height', overlayHeight); 3387 } else { 3388 overlay.removeAttr('style'); 3389 } 3390 } 3391 3392 function removePerspectiveWhileScrolling(slider) { 3393 slider.on('clb-slider.change', function () { 3394 $(this).addClass('perspective-remove'); 3395 }); 3396 setTimeout(function () { 3397 slider.on('clb-slider.changed', function () { 3398 $(this).removeClass('perspective-remove'); 3399 }); 3400 }, 500); 3401 } 3402 3403 function fadeoutSliderItemAnimation(slider) { 3404 slider.on('clb-slider.next-change', function () { 3405 3406 var activeItems = slider.find('.clb-slider-item.active'); 3407 activeItems.eq(0).addClass('last-active'); 3408 3409 setTimeout(function () { 3410 activeItems.eq(0).removeClass('last-active'); 3411 }, 1000); 3412 3413 }).on('clb-slider.prev-change', function () { 3414 3415 var activeItems = slider.find('.clb-slider-item.active'); 3416 activeItems.eq(activeItems.length - 1).addClass('last-active'); 3417 3418 setTimeout(function () { 3419 activeItems.eq(activeItems.length - 1).removeClass('last-active'); 3420 }, 1000); 3421 3422 }); 3423 } 3424 3425 /* End onepage slider help functions*/ 3426 3427 function handleSmoothSlider(onePage) { 3428 //Init 3429 if (onePage === undefined) { 3430 var onePage = $('.portfolio-onepage-slider'); 3431 } 3432 3433 onePage.addClass('clb-smooth-slider'); 3434 3435 var currentItem = 0; 3436 var onePageItems = onePage.children().addClass('clb-smooth-slider-item'); 3437 var onePageItemsCount = onePageItems.length; 3438 3439 //Settings 3440 var loopSetting = Boolean(onePage.attr('data-slider-loop')), 3441 navSetting = Boolean(onePage.attr('data-slider-navigation')), 3442 bulletsSetting = Boolean(onePage.attr('data-slider-dots')), 3443 paginationSetting = Boolean(onePage.attr('data-slider-pagination')), 3444 mousescrollSetting = Boolean(onePage.attr('data-slider-mousescroll')), 3445 autoplaySetting = Boolean(onePage.attr('data-slider-autoplay')), 3446 autoplayTimeSetting = onePage.attr('data-slider-autoplay-time'); 3447 3448 onePage.css({ 3449 'height': onePageItems.height() 3450 }); 3451 3452 $(window).on('resize', function () { 3453 onePage.css({ 3454 'height': onePageItems.height() 3455 }); 3456 }); 3457 3458 onePageItems.css({ 3459 'position': 'absolute', 3460 }); 3461 3462 /*Events*/ 3463 onePage.on('next-slide', function (e) { 3464 nextSlide(); 3465 }); 3466 3467 onePage.on('prev-slide', function (e) { 3468 prevSlide(); 3469 }); 3470 3471 /*Create elements*/ 3472 3473 //Nav btn 3474 if (navSetting === true) { 3475 var createNavBtn = '<div class="clb-slider-nav-btn"><div class="prev-btn btn-round btn-round-light" tabindex="0"><i class="ion"><svg class="arrow-icon arrow-icon-back" width="16" height="16" viewB
3475ox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 8H15M15 8L8.5 1.5M15 8L8.5 14.5" stroke-width="2" stroke-linejoin="round"/></svg></i></div><div class="next-btn btn-round btn-round-light" tabindex="0"><i class="ion"><svg class="arrow-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 8H15M15 8L8.5 1.5M15 8L8.5 14.5" stroke-width="2" stroke-linejoin="round"/></svg></i></div></div>'; 3476 onePage.append($(createNavBtn)); 3477 } 3478 //Pagination 3479 if (paginationSetting === true || bulletsSetting === true) { 3480 var createPagination = $('<div></div>'); 3481 var page = $('<div class="clb-slider-page"></div>'); 3482 3483 if (paginationSetting === true) { 3484 createPagination.addClass('clb-slider-pagination'); 3485 for (var i = 1; i <= onePageItemsCount; i++) { 3486 if (i < 10) { 3487 page.clone().append('<span class="clb-slider-pagination-index"> 0' + i + '</span>').appendTo(createPagination); 3488 } else { 3489 page.clone().append('<span class="clb-slider-pagination-index">' + i + '</span>').appendTo(createPagination); 3490 } 3491 } 3492 } else { 3493 createPagination.addClass('clb-slider-nav-dots'); 3494 page.addClass('clb-slider-dot'); 3495 for (var i = 1; i <= onePageItemsCount; i++) { 3496 page.clone().appendTo(createPagination); 3497 } 3498 } 3499 3500 createPagination.find('.clb-slider-page:first-child').addClass('active'); 3501 onePage.append(createPagination); 3502 3503 $(onePageItems).removeClass('prev-slide next-slide active'); 3504 $(onePageItems.slice(0, currentItem)).addClass('prev-slide'); 3505 $(onePageItems.slice(currentItem + 1)).addClass('next-slide'); 3506 $(onePageItems[currentItem]).addClass('active'); 3507 3508 //pagination 3509 var paginationNumbers = onePage.find('.clb-slider-page'); 3510 var navBtnId = 0; 3511 paginationNumbers.on('click', function () { 3512 paginationNumbers.removeClass('active'); 3513 $(this).addClass('active'); 3514 navBtnId = $(this).index(); 3515 3516 //navBtnId + 1 because navBtnId start from 0 and slideNow start from 1 3517 if (navBtnId != currentItem) { 3518 if (navBtnId + 1 > onePageItemsCount) { 3519 navBtnId = navBtnId - settings.items + 1; 3520 } 3521 3522 var lastSlide = currentItem 3523 currentItem = navBtnId; 3524 toSlide(lastSlide); 3525 } 3526 }); 3527 3528 } else { 3529 $(onePageItems[currentItem]).addClass('active'); 3530 $(onePageItems[onePageItemsCount - 1]).addClass('prev-slide'); 3531 $(onePageItems[currentItem + 1]).addClass('next-slide'); 3532 } 3533 3534 /*Script work place*/ 3535 3536 //Nav btn 3537 onePage.find('.next-btn').on('click', function () { 3538 nextSlide(); 3539 }); 3540 3541 onePage.find('.prev-btn').on('click', function () { 3542 prevSlide(); 3543 }); 3544 3545 //Key controll 3546 $(window).on('keydown', function (e) { 3547 var key = e.which || e.keyCode; 3548 3549 if (key == 37) { 3550 prevSlide(); 3551 } 3552 if (key == 39) { 3553 nextSlide(); 3554 } 3555 }); 3556 3557 //Mouse scroll 3558 if (mousescrollSetting === true) { 3559 if (navigator.userAgent.indexOf('Mac OS X') != -1) { 3560 var timeoutDelay = 1300; 3561 } else { 3562 var timeoutDelay = 1000; 3563 } 3564 var wheel = true; 3565 var top = onePage.offset().top - ($(window).height() - onePage.outerHeight()) / 2; 3566 onePage.on('wheel mousewheel', function (e) { 3567 3568 var y = e.originalEvent.deltaY; 3569 if ((currentItem == 0 && y > 0) || (currentItem == onePageItemsCount && y < 0)) { 3570 $("html, body").animate({ scrollTop: onePage.offset().top + 'px' }); 3571 e.preventDefault(); 3572 } 3573 3574 if (wheel) { 3575 if (y > 0 && currentItem <= onePageItemsCount - 1) { 3576 3577 nextSlide(); 3578 wheel = false;
3579 3580 if (loopSetting) { 3581 e.preventDefault(); 3582 } else { 3583 if (!(currentItem == onePageItemsCount)) { 3584 e.preventDefault(); 3585 } else { 3586 $('html, body').stop(true, true).finish(); 3587 } 3588 } 3589 } else if (y < 0 && currentItem >= 0) { 3590 3591 if (loopSetting) { 3592 e.preventDefault(); 3593 } else { 3594 if (!(currentItem == 0)) { 3595 e.preventDefault(); 3596 } else { 3597 $('html, body').stop(true, true).finish(); 3598 } 3599 } 3600 prevSlide(); 3601 wheel = false; 3602 } 3603 } else { 3604 return false; 3605 } 3606 3607 setTimeout(function () { 3608 wheel = true; 3609 }, timeoutDelay); 3610 }); 3611 } 3612 3613 //Touch events 3614 3615 onePage.on('touchstart', function (e) { 3616 3617 var cursorPosition = e.originalEvent.touches[0].pageX; 3618 3619 onePage.on('touchmove', function (e) { 3620 3621 var position = e.originalEvent.touches[0].pageX; 3622 3623 if (position + 50 < cursorPosition) { 3624 nextSlide(); 3625 cursorPosition = e.clientX; 3626 } else if (position - 50 > cursorPosition) { 3627 prevSlide(); 3628 cursorPosition = e.clientX; 3629 } 3630 }) 3631 3632 3633 onePage[0].ondragstart = function () { 3634 return false; 3635 }; 3636 }); 3637 3638 //Autoplay 3639 if (autoplaySetting === true) { 3640 var autoSlideInterval = setInterval(function () { 3641 if (!onePage.hasClass('stop-slide')) { 3642 nextSlide(); 3643 } 3644 }, autoplayTimeSetting); 3645 3646 onePage.hover(function () { 3647 $(this).addClass('stop-slide'); 3648 }, function () { 3649 $(this).removeClass('stop-slide'); 3650 }); 3651 } 3652 3653 //ScrollBar 3654 function portfolioScrollBar() { 3655 if (onePage.hasClass('portfolio-onepage-slider')) { 3656 let percentage = (100 / onePageItemsCount) * (currentItem + 1); 3657 3658 if (percentage > 100) percentage = 100; 3659 3660 $('.scroll-track').css('width', percentage + '%'); 3661 } 3662 } 3663 3664 function nextSlide() { 3665 3666 if (loopSetting) { 3667 if (currentItem + 1 == onePageItemsCount) { 3668 currentItem = 0; 3669 $(onePageItems).removeClass('active prev-slide last-slide'); 3670 $(onePageItems[onePageItemsCount - 1]).addClass('prev-slide last-slide'); 3671 } else if (currentItem + 2 == onePageItemsCount) { 3672 $(onePageItems[0]).addClass('next-slide'); 3673 currentItem++; 3674 } else if (currentItem == 0) { 3675 $(onePageItems[onePageItemsCount - 1]).removeClass('prev-slide'); 3676 currentItem++; 3677 } else { 3678 currentItem++; 3679 } 3680 } else { 3681 currentItem++; 3682 } 3683 3684 if (paginationSetting) { 3685 paginationNumbers.removeClass('active'); 3686 $(paginationNumbers[currentItem]).addClass('active'); 3687 } 3688 3689 if (!(currentItem == onePageItemsCount)) { 3690 $(onePageItems[currentItem - 1]).addClass('last-slide').removeClass('active'); //prev slide 3691 $(onePageItems[currentItem - 2]).removeClass('prev-slide'); //other sldies 3692 $(onePageItems[currentItem]).removeClass('next-slide').addClass('active'); //active slide 3693 3694 $(onePageItems[currentItem - 1]).addClass('prev-slide'); //prev slide 3695 $(onePageItems[currentItem + 1]).addClass('next-sl
3695ide'); //next slide 3696 setTimeout(function () { 3697 $(onePageItems).removeClass('last-slide'); 3698 }, 800); 3699 3700 } 3701 3702 portfolioScrollBar(); 3703 } 3704 3705 function prevSlide() { 3706 if (loopSetting) { 3707 if (currentItem <= 0) { 3708 currentItem = onePageItemsCount - 1; 3709 $(onePageItems).removeClass('active next-slide last-slide'); 3710 $(onePageItems[0]).addClass('next-slide last-slide'); 3711 } else if (currentItem == 1) { 3712 $(onePageItems[onePageItemsCount - 1]).addClass('prev-slide'); 3713 currentItem--; 3714 } else if (currentItem == onePageItemsCount - 1) { 3715 $(onePageItems[0]).removeClass('next-slide'); 3716 currentItem--; 3717 } else { 3718 currentItem--; 3719 } 3720 } else { 3721 if (!(currentItem == 0)) { 3722 currentItem--; 3723 } 3724 } 3725 3726 if (paginationSetting) { 3727 paginationNumbers.removeClass('active'); 3728 $(paginationNumbers[currentItem]).addClass('active'); 3729 } 3730 3731 if (!(currentItem < 0)) { 3732 $(onePageItems[currentItem]).addClass('active').removeClass('prev-slide'); //active slide 3733 $(onePageItems[currentItem + 1]).removeClass('active').addClass('last-slide'); //next slide 3734 $(onePageItems[currentItem + 2]).removeClass('next-slide').removeClass('last-slide'); //prev slide 3735 3736 $(onePageItems[currentItem - 1]).addClass('prev-slide'); //prev-slide 3737 $(onePageItems[currentItem + 1]).addClass('next-slide'); //next-slide 3738 3739 setTimeout(function () { 3740 $(onePageItems).removeClass('last-slide'); 3741 }, 800); 3742 } 3743 3744 portfolioScrollBar() 3745 } 3746 3747 function toSlide(lastSlide) { 3748 $(onePageItems[lastSlide]).addClass('last-slide'); 3749 $(onePageItems).removeClass('prev-slide next-slide active'); 3750 3751 $(onePageItems.slice(0, currentItem)).addClass('prev-slide'); 3752 3753 $(onePageItems.slice(currentItem)).addClass('next-slide'); 3754 3755 $(onePageItems[currentItem]).addClass('active'); 3756 $(onePageItems[currentItem - 1]).addClass('prev-slide'); //prev slide 3757 $(onePageItems[currentItem + 1]).addClass('next-slide'); //next slide 3758 3759 setTimeout(function () { 3760 $(onePageItems).removeClass('last-slide'); 3761 }, 800); 3762 3763 portfolioScrollBar(); 3764 } 3765 3766 portfolioScrollBar(); 3767 } 3768 3769 // Background image parallax effect 3770 function handleBgParallaxEffect() { 3771 var tiltContainer = $('[data-tilt-effect]'); 3772 3773 var userAgent = navigator.userAgent.toLowerCase(); 3774 var isSafari = false 3775 3776 if (userAgent.indexOf('safari') != -1) { 3777 if (userAgent.indexOf('chrome') > -1) { 3778 isSafari = false; // Chrome 3779 } else { 3780 isSafari = true; // Safari 3781 } 3782 } 3783 3784 tiltContainer.each(function () { 3785 var isTiltEnable = Boolean($(this).attr('data-tilt-effect')); 3786 3787 if (isTiltEnable) { 3788 if (isSafari == false) { 3789 var container = $(this)[0].querySelectorAll(".parallax-holder"); 3790 3791 $(container).each(function (i) { 3792 var inner = $(this).find(".parallax")[0]; 3793 let container = $(this)[0]; 3794 var mouse = { 3795 _x: 0, 3796 _y: 0, 3797 x: 0, 3798 y: 0, 3799 item: '', 3800 updatePosition: function (event) { 3801 var e = event || window.event; 3802 if (isSliderItem($(container))) { 3803 this.x = e.pageX - (Math.floor($(container).width() / 2) + $(container).offset().left); 3804 this.y = (e.pageY - (Math.floor($(container).height() / 2) + $(container).offset().top)) * -1; 3805 } else { 3806 this.x = e.pageX - this._x; 3807 this.y = (e.pageY - this._y) * -1; 3808 } 3809 3810 }, 3811 setOrigin: function (e) { 3812 this._x = Math.floor($(e).width() / 2) + $(container).offset().left; 3813 this._y = Math.floor($(e).height() / 2) + $(container).offset().top; 3814 }, 3815 show: function () { 3816 return "(" + this.x + ", " + this.y + ")"; 3817 } 3818 }; 3819 3820 // Track the mouse position relative to the center of the container. 3821 mouse.setOrigin(container); 3822 3823 var counter = 0; 3824 var refreshRate = 10; 3825 var isTimeToUpdate = function () { 3826 return counter++ % refreshRate === 0; 3827 }; 3828 3829 var onMouseEnterHandler = function (event) { 3830 update(event); 3831 }; 3832 3833 var onMouseLeaveHandler = function () { 3834 // inner.style = ""; 3835 inner.style.transform = ""; 3836 inner.style.webkitTransform = ""; 3837 inner.style.mozTranform = ""; 3838 inner.style.msTransform = ""; 3839 inner.style.oTransform = ""; 3840 }; 3841 3842 var onMouseMoveHandler = function (event) { 3843 if (isTimeToUpdate()) { 3844 update(event); 3845 } 3846 }; 3847 3848 var update = function (event) { 3849 mouse.updatePosition(event); 3850 updateTransformStyle( 3851 (mouse.y / inner.offsetHeight / 2).toFixed(2), 3852 (mouse.x / inner.offsetWidth / 2).toFixed(2) 3853 ); 3854 }; 3855 3856 var updateTransformStyle = function (x, y) { 3857 var style = "rotateX(" + x + "deg) rotateY(" + y + "deg)"; 3858 inner.style.transform = style; 3859 inner.style.webkitTransform = style; 3860 inner.style.mozTranform = style; 3861 inner.style.msTransform = style; 3862 inner.style.oTransform = style; 3863 }; 3864 3865 container.onmousemove = onMouseMoveHandler; 3866 container.onmouseleave = onMouseLeaveHandler; 3867 container.onmouseenter = onMouseEnterHandler; 3868 3869 function isSliderItem(item) { 3870 if (item.hasClass('clb-slider-item') || item.parents('.clb-slider-item').length) { 3871 return true; 3872 } 3873 } 3874 }); 3875 } 3876 } 3877 }); 3878 } 3879 3880 function handleCircleProgressBar() { 3881 3882 var circleProgressBar = $('.circle-progress-bar:not([data-processed])'); 3883 var scrollTop = $(document).scrollTop() + $(window).height(); 3884 3885 circleProgressBar.each(function (i) { 3886 var _this = $(this); 3887 3888 var progressValue = $(this).find('.progress__value')[0]; 3889 var value = $(_this).data('percent-value'); 3890 3891 const radius = progressValue.r.animVal.value; 3892 const circumference = 2 * Math.PI * radius; 3893 3894 if (scrollTop > _this.offset().top + _this.height() ) { 3895 _this.attr("data-processed", "true"); 3896 function progress(value) { 3897 var progress = value / 100; 3898 var dashoffset = circumference * (1 - progress); 3899 progressValue.style.strokeDashoffset = dashoffset; 3900 } 3901 3902 progressValue.style.strokeDasharray = circumference; 3903 if (value < 0) value = 0; 3904 if (value > 100) value = 100; 3905 progress(value); 3906 3907 var counters = _this.find(".percent-wrap .percent")[0]; 3908 var counter = parseInt(counters.innerHTML); 3909 3910 var count = function (start, value, i) { 3911 var localStart = start; 3912 3913 setInterval(function () { 3914 if (localStart < value) { 3915 localStart++; 3916 counters.innerHTML = localStart; 3917 } 3918 }, 1000 / value); 3919 } 3920 3921 count(0, value, i); 3922 } 3923 }); 3924 } 3925 $(window).on('ohio:handle_circle_progress_bar', handleCircleProgressBar); 3926 3927 function handleScrollMeter() { 3928 const bHeight = $('body').height(); 3929 const scrolled = $(window).innerHeight() + $(window).scrollTop(); 3930 3931 let percentage = ((scrolled / bHeight) * 100); 3932 3933 if (percentage > 100) percentage = 100; 3934 3935 $('.clb-scroll-top:not(.clb-slider-scroll-top) .scroll-track').css('width', percentage + '%'); 3936 } 3937 3938 function handleTeamMemberInner() { 3939 var teamMember = $('.team-member.inner'); 3940 3941 teamMember.each(function () { 3942 var self = $(this); 3943 var teamMemberWrap = self.find('.team-member_wrap'); 3944 var teamMemberDescWrap = self.find('.team-member_description_wrap'); 3945 var teamMemberImage = self.find('.team-member_image'); 3946 3947 teamMemberDescWrap.show(); 3948 3949 teamMemberWrap.css({ 3950 'transform': 'translateY(' + teamMemberDescWrap.outerHeight() + 'px)' 3951 }); 3952 3953 teamMemberImage.hover(function () { 3954 teamMemberWrap.css({ 3955 'transform': 'none' 3956 }); 3957 }, function () { 3958 teamMemberWrap.css({ 3959 'transform': 'translateY(' + teamMemberDescWrap.outerHeight() + 'px)' 3960 }); 3961 }) 3962 3963 }); 3964 } 3965 3966 function handleHorizontalAccordion() { 3967 var accordion = $('.horizontal_accordion'); 3968 3969 accordion.each(function () { 3970 var selfAccordion = $(this); 3971 var items = selfAccordion.find('.horizontal_accordionItem'); 3972 var percent = Clb.isMobile ? 90 : 100 - (100 / (items.length - 1)); 3973 var i = items.length, 3974 z = 1, 3975 t = items.length - 1; 3976 var currentItem; 3977 var currentItemIndex; 3978 3979 if (Clb.isMobile) { 3980 items.removeAttr('style'); 3981 } else { 3982 items.eq(0).addClass('active'); 3983 3984 //z-index for each items by descending 3985 for (; i > 0; i--) { 3986 items.eq(i - 1).css({ 3987 'z-index': z 3988 }); 3989 3990 if (i > 1) { 3991 items.eq(i - 1).css({ 3992 'transform': 'translateX(-' + percent * t + '%)' 3993 }); 3994 t--; 3995 } 3996 z++; 3997 } 3998 3999 items.on('click', function (i) { 4000 currentItem = $(this); 4001 currentItemIndex = items.index(currentItem); 4002 openItem(items, currentItemIndex, currentItem, selfAccordion, percent); 4003 4004 if (selfAccordion.find('.horizontal_accordionItem.moved').length) { 4005 selfAccordion.addClass('open'); 4006 } else { 4007 setTimeout(function () { 4008 selfAccordion.removeClass('open'); 4009 }, 400); 4010 } 4011 }); 4012 } 4013 }); 4014 4015 function openItem(items, currentItemIndex, currentItem, selfAccordion, percent) { 4016 var movedItems; 4017 var movingItems; 4018 var movingItemsIndex = currentItemIndex; 4019 4020 if (currentItem.hasClass('moved')) { 4021 movedItems = selfAccordion.find('.horizontal_accordionItem.moved'); 4022 movingItems = movedItems.slice(currentItemIndex, movedItems.length); 4023 4024 movedItems.each(function (i) { 4025 if (i >= movingItemsIndex) { 4026 setTimeout(function () { 4027 movedItems.eq(movingItemsIndex).css('transform', 'translateX(-' + percent * (movingItemsIndex) + '%)'); 4028 movingItemsIndex++; 4029 }, 50 * i); 4030 } 4031 4032 }); 4033 movingItems.removeClass('moved'); 4034 items.removeClass('active'); 4035 currentItem.addClass('active'); 4036 } else { 4037 movingItems = items.slice(0, currentItemIndex).addClass('moved'); 4038 4039 movingItems.each(function (i) { 4040 setTimeout(function () { 4041 items.eq(i).css('transform', 'translateX(-' + percent * (i + 1) + '%)'); 4042 }, 50 * i); 4043 }); 4044 4045 items.removeClass('active'); 4046 currentItem.addClass('active'); 4047 } 4048 } 4049 } 4050 $(window).on('ohio:handle_accordion_horizontal_box', handleHorizontalAccordion); 4051 4052 function handleBackLinkPosition() { 4053 var backLink = document.querySelectorAll('.clb-back-link'); 4054 var backLinkOffset = 0; 4055 4056 if ($("#wpadminbar").length) { 4057 backLinkOffset = backLinkOffset + $("#wpadminbar").height(); 4058 } 4059 4060 if (backLink.length && Clb.header && Clb.header.length) { 4061 var isTopHeader = Clb.header.hasClass('header-1') || Clb.header.hasClass('header-2') || Clb.header.hasClass('header-3') || Clb.header.hasClass('header-4'); 4062 4063 if (isTopHeader) { 4064 backLink[0].style.top = backLinkOffset + Clb.header.height() + 'px'; 4065 } 4066 backLink[0].classList.add('showed'); 4067 } 4068 } 4069 4070 function handleMasonry() { 4071 // Masonry && AOS 4072 4073 if ($('.ohio-masonry').length) { 4074 setTimeout(function () { 4075 $('.ohio-masonry').each(function () { 4076 var columnWidth = '.grid-item'; 4077 if ($(this).find('.grid-item').length == 0) { 4078 columnWidth = '.masonry-block'; 4079 } 4080 4081 $(this).masonry({ 4082 itemSelector: '.masonry-block', 4083 columnWidth: columnWidth, 4084 horizontalOrder: true, 4085 isAnimated: false, 4086 hiddenStyle: { 4087 opacity: 0, 4088 transform: '' 4089 } 4090 }); 4091 }); 4092 4093 setTimeout(function () { 4094 handleAOS(); 4095 }, 50); 4096 }, 50); 4097 } else { 4098 handleAOS(); 4099 } 4100 } 4101 $(window).on('ohio:handle_masonry', handleMasonry); 4102 4103 function handleScrollShareBar() { 4104 var mediaHolder = $('[data-scroll-share-bar]'); 4105 if (mediaHolder.length) { 4106 var windowHeigth = $(window).height()
4107 var mediaHolderHeight = mediaHolder.height(); 4108 var mediaHolderOffset = mediaHolder.offset().top; 4109 4110 $(window).on('scroll', function () { 4111 if ($(this).scrollTop() >= (mediaHolderHeight - windowHeigth) + mediaHolderOffset) { 4112 mediaHolder.addClass('scroll-end'); 4113 } else { 4114 mediaHolder.removeClass('scroll-end'); 4115 } 4116 }); 4117 } 4118 } 4119 4120 function handleCustomSelect() { 4121 var select = $('select:not(.select2-hidden-accessible)'); 4122 4123 select.each(function () { 4124 if (!$(this).parent().hasClass('select-holder')) { 4125 select.each(function () { 4126 $(this).wrapAll('<div class="select-holder"/>'); 4127 }); 4128 } 4129 }) 4130 } 4131 4132 function handleLanguageSelect() { 4133 var select = $('select.lang-dropdown-select'); 4134 4135 select.on('change', function () { 4136 window.location.href = this.value 4137 }); 4138 } 4139 4140 function handleDarkSectionColors() { 4141 var section = $('.clb__dark_section, .clb__light_section'); 4142 var sectionClass; 4143 4144 if (section.length) { 4145 var scrollTop = $('.clb-scroll-top'); 4146 var socialLinks = $('.clb-social'); 4147 var fixedSearch = $('.search-global.fixed .ion'); 4148 var dynamicHeader = $('.header-dynamic-typo'); 4149 var self_window; 4150 4151 activeSection($(window)); 4152 4153 $(window).on('scroll', function () { 4154 self_window = $(this); 4155 activeSection(self_window); 4156 }); 4157 4158 function activeSection(self_window) { 4159 var st = self_window.scrollTop() + self_window.height() / 2; 4160 section.each(function () { 4161 4162 var sectionOffset = $(this).offset().top; 4163 var currentSection = $(this); 4164 4165 //Fix for sticky footer 4166 if (currentSection.hasClass('site-footer sticky')) { 4167 if (!(st > ($(document).height() - self_window.height()))) { 4168 scrollTop.removeClass('dark-typo light-typo'); 4169 socialLinks.removeClass('dark-typo light-typo'); 4170 fixedSearch.removeClass('dark-typo light-typo'); 4171 dynamicHeader.removeClass('dark-typo light-typo'); 4172 return; 4173 } 4174 } 4175 4176 if (currentSection.hasClass('clb__dark_section')) { 4177 sectionClass = 'light-typo'; 4178 dynamicHeader.removeClass('dark-typo'); 4179 } else if (currentSection.hasClass('clb__light_section')) { 4180 sectionClass = 'dark-typo'; 4181 dynamicHeader.removeClass('light-typo'); 4182 } 4183 4184 if (sectionOffset + currentSection.outerHeight() > st && st > sectionOffset) { 4185 scrollTop.addClass(sectionClass); 4186 socialLinks.addClass(sectionClass); 4187 fixedSearch.addClass(sectionClass); 4188 dynamicHeader.addClass(sectionClass); 4189 4190 return false; 4191 } else { 4192 scrollTop.removeClass(sectionClass); 4193 socialLinks.removeClass(sectionClass); 4194 fixedSearch.removeClass(sectionClass); 4195 dynamicHeader.removeClass(sectionClass); 4196 } 4197 }); 4198 } 4199 } 4200 } 4201 4202 function handleRemoveSliderBulletsClass() { 4203 var slider = $('.project-fullscreen-slider.clb-slider, .portfolio-onepage-slider.clb-slider, .fullscreen-slider.clb-slider, .portfolio-onepage-slider.clb-smooth-slider'); 4204 var self_window; 4205 var body = $('body'); 4206 4207 if (slider.length && slider.find('.clb-slider-pagination').length) { 4208 if (slider.length && slider.offset().top <= $(window).scrollTop() + 50) { 4209 body.addClass('slider-with-bullets'); 4210 } 4211 } 4212 4213 $(window).on('scroll', function () { 4214 self_window = $(this); 4215 activeSection(self_window); 4216 }); 4217 4218 function activeSection(self_window) { 4219 var st = self_window.scrollTop() + self_window.height() / 2; 4220 slider.each(function () { 4221 4222 var sliderOffset = $(this).offset().top; 4223 var currentslider = $(this); 4224 4225 if (sliderOffset + currentslider.outerHeight() > st && st > sliderOffset) { 4226 body.addClass('slider-with-bullets'); 4227 return false;
4228 } else { 4229 body.removeClass('slider-with-bullets'); 4230 } 4231 }); 4232 } 4233 } 4234 $(window).on('ohio:handle_remove_slider_bullets', handleRemoveSliderBulletsClass); 4235 4236 function handlePageColorSwitcher() { 4237 var switcher = $('.clb-mode-switcher'); 4238 var switcherItems = switcher.find('.clb-mode-switcher-item, .clb-mode-switcher-toddler'); 4239 var coloredSections = $('.clb__light_section, .clb__dark_section'); 4240 var scrollTop = $('.clb-scroll-top'); 4241 var socialLinks = $('.clb-social'); 4242 var fixedSearch = $('.search-global.fixed .ion'); 4243 var dynamicHeader = $('.header-dynamic-typo'); 4244 4245 equalSize(switcherItems, 'width'); 4246 4247 if (Clb.body.hasClass('dark-scheme')) { 4248 switcher.addClass('dark'); 4249 } 4250 4251 if (document.cookie == 'ohio-swticher-state=dark') { 4252 coloredSections.toggleClass('clb__light_section clb__dark_section'); 4253 } 4254 4255 switcher.on('click', function () { 4256 $(Clb.body).addClass('switching'); 4257 $(Clb.body).toggleClass('dark-scheme'); 4258 $(this).toggleClass('dark'); 4259 4260 coloredSections.toggleClass('clb__light_section clb__dark_section'); 4261 4262 scrollTop.removeClass('dark-typo light-typo'); 4263 socialLinks.removeClass('dark-typo light-typo'); 4264 fixedSearch.removeClass('dark-typo light-typo'); 4265 dynamicHeader.removeClass('dark-typo light-typo'); 4266 4267 if (ohioVariables && ohioVariables.save_color_mode_state) { 4268 document.cookie = 'ohio-swticher-state=' + (($(Clb.body).hasClass('dark-scheme')) ? 'dark' : 'light'); 4269 } 4270 4271 4272 setTimeout(function () { 4273 $(Clb.body).removeClass('switching'); 4274 }, 10); 4275 }); 4276 } 4277 4278 function equalSize(items, attr) { 4279 var maxSize = 0; 4280 var value = 0; 4281 4282 items.each(function () { 4283 // .replace remove 'px' from returning value 4284 value = $(this).css(attr).replace(/(^\d+)(.+$)/i, '$1'); 4285 4286 if (value > maxSize) { 4287 maxSize = +($(this).css(attr).replace(/(^\d+)(.+$)/i, '$1')); 4288 } 4289 }); 4290 4291 var css = {}; 4292 css[attr] = maxSize; 4293 4294 items.css(css); 4295 } 4296 4297 4298 function percentagePreloader() { 4299 var counter = 0; 4300 var count = 0; 4301 var isLoad = false; 4302 4303 $(window).on('load', function () { 4304 isLoad = true; 4305 }); 4306 4307 setTimeout(function () { 4308 var breakPoint = Math.floor(Math.random() * 29) + 70; 4309 4310 var i = setInterval(function () { 4311 $(".sk-percentage .sk-percentage-percent").html(count + "%"); 4312 $(".sk-percentage").css("width", count + "%"); 4313 if (counter == 100) { 4314 clearInterval(i); 4315 setTimeout(function () { 4316 $("#page-preloader").addClass('hidden'); 4317 }, 10) 4318 4319 } else if (counter == breakPoint) { 4320 4321 if (isLoad) { 4322 counter++; 4323 count++; 4324 } else { 4325 counter = breakPoint; 4326 count = breakPoint; 4327 } 4328 4329 } else { 4330 counter++; 4331 count++; 4332 } 4333 }, 12); 4334 }); 4335 } 4336 4337 function handleInteractiveLinksGrid() { 4338 var grid = $('[data-interactive-links-grid]'); 4339 var gridItems = grid.find('.portfolio-item-wrap '); 4340 createImagesForInteractiveLinksGrid(grid.find('[data-lazy-container]')); 4341 var gridImages = $('.portfolio-grid-images .portfolio-metro-image') 4342 4343 gridItems.each(function () { 4344 var self = $(this); 4345 4346 self.mouseenter(function () { 4347 self.find('.portfolio-item').addClass('visible'); 4348 gridItems.find('.portfolio-item').not('.visible').addClass('invisible'); 4349 gridImages.eq(self.index()).addClass('scale'); 4350 }).mouseleave(function () { 4351 gridItems.find('.portfolio-item').removeClass('invisible visible'); 4352 gridImages.removeClass('scale'); 4353 }); 4354 }); 4355 } 4356 $(window).on('ohio:handle_interactive_links_grid', handleInteractiveLinksGrid); 4357 4358 function createImagesForInteractiveLinksGrid(grid) { 4359 var gridItem = grid.find('[data-featured-image]'); 4360 var gridImages = $('.interactive-links-grid-images'); 4361 gridImages.empty(); 4362 4363 gridItem.each(function () { 4364 var bgImage = $('<div class="portfolio-metro-image interactive-links-grid-image"></div>'); 4365 bgImage.css('background-image', 'url(' + $(this).data('featured-image') + ')'); 4366 gridImages.append(bgImage); 4367 }); 4368 } 4369 4370 function handlePortfolioMovingDetailsGrid() { 4371 var grid = $(".grid_11"); 4372 if (grid.length) {
4373 var portfolioItem = grid.find('.portfolio-grid-type-11'); 4374 4375 portfolioItem.on('mouseover mousemove', function (event) { 4376 $(this).find('.portfolio-item-details')[0].style.transform = 'translate(' + event.clientX + 'px, ' + event.clientY + 'px' + ')'; 4377 }); 4378 4379 portfolioItem.on('mouseleave', function (event) { 4380 $(this).find('.portfolio-item-details')[0].style.transform = 'translate(0px, 0px' + ')'; 4381 }); 4382 } 4383 } 4384 $(window).on('ohio:handle_portfolio_moving_details_grid', handlePortfolioMovingDetailsGrid); 4385 4386 function handleProjectScrollScale() { 4387 var project = $('.scroll-scale-image'); 4388 var projectImage = project.find('.project-page-media-holder .project-image'); 4389 if (projectImage.length) { 4390 var scale = 1.0; 4391 var lastScrollTop = 0; 4392 var projectImageOffset = projectImage.offset().top; 4393 var projectImageHeight = projectImage.height(); 4394 var wndHeight = $(window).height(); 4395 var projectImageHeight = projectImage.height(); 4396 var modifier = 0; 4397 4398 //(-parallaxTop + contentScroll + wndHeight) / (parallaxHeight + wndHeight) 4399 4400 $(window).on('scroll', function () { 4401 var st = $(this).scrollTop(); 4402 modifier = ((st) / (projectImageHeight + wndHeight) / 5); 4403 4404 if (st < projectImageOffset + projectImageHeight) { 4405 if (st > lastScrollTop) { 4406 //Down 4407 setTimeout(function () { 4408 projectImage.css('transform', 'scale(' + scale + ')'); 4409 scale = 1 + modifier; 4410 }, 50); 4411 } 4412 else { 4413 //Up 4414 projectImage.css('transform', 'scale(' + scale + ')'); 4415 if (scale > 1.005) { 4416 scale = 1 + modifier; 4417 } 4418 } 4419 } 4420 lastScrollTop = st; 4421 }); 4422 } 4423 } 4424 4425 function handleGlobalPageAnimation() { 4426 var isGLobalAnim = $('.global-page-animation'); 4427 4428 if (isGLobalAnim.length) { 4429 var isURIPrefix = false; 4430 4431 $('a[href]:not(.btn-lightbox):not(.prettyphoto):not(.clb-scroll-top):not(.elementor-gallery-item):not([data-elementor-open-lightbox]):not(.woocommerce-MyAccount-downloads-file):not(.add_to_cart_button)').on('click', function (e) { 4432 var link = $(this).attr('href'); 4433 4434 if (link.indexOf('http') == -1 && link.indexOf(':') != -1) { 4435 isURIPrefix = true 4436 } 4437 4438 if (link && link.charAt(0) != '#' && $(this).attr('target') != '_blank' && !isURIPrefix) { 4439 e.preventDefault(); 4440 isGLobalAnim.removeClass('global-page-animation-active'); 4441 isGLobalAnim.addClass('global-page-animation-fade-out') 4442 setTimeout(function () { 4443 $('.page-preloader:not(.percentage-preloader)').removeClass('hidden'); 4444 }, 800); 4445 4446 setTimeout(function () { 4447 document.location.href = link; 4448 }, 850); 4449 } 4450 }); 4451 } 4452 } 4453 $(window).on('ohio:handle_global_page_animation', handleGlobalPageAnimation); 4454 4455 function handleStickySection() { 4456 var sticky = $('.sticky-section'); 4457 4458 if (sticky.length) { 4459 4460 sticky.each(function () { 4461 4462 var secondImage = $(this).find('.sticky-section-item-second-image'); //projectImage 4463 var lastScrollTop = 0; 4464 var stickyItemHeight = $('.sticky-section-item').height(); 4465 var stickyItemOffset = $('.sticky-section-item').offset().top; //projectImageOffset 4466 var secondImageHeight = secondImage.height(); //projectImageHeight 4467 var wndHeight = $(window).height(); 4468 var modifier = 0; 4469 var inset = secondImageHeight; 4470 4471 $(window).on('scroll', function () { 4472 var st = $(this).scrollTop(); 4473 modifier = ((st) / (secondImageHeight + wndHeight)) * 20; //((st) / (secondImageHeight + wndHeight) / 5) 4474 if (st > stickyItemOffset + ((stickyItemHeight / 2) - secondImageHeight)) { 4475 if (st > lastScrollTop) { 4476 //Down 4477 if (inset > 0) { 4478 secondImage.css('clip-path', 'inset(' + inset + 'px 0px 0px)'); 4479 inset = inset - modifier; 4480 } 4481 } 4482 else { 4483 //Up 4484 if (inset < secondImageHeight) { 4485 secondImage.css('clip-path', 'inset(' + inset + 'px 0px 0px)'); 4486 inset = inset + modifier; 4487 } 4488 } 4489 } 4490 lastScrollTop = st; 4491 }); 4492 4493 }); 4494 4495 } 4496 } 4497 4498 function handleZoomProductImage() {
4499 $('.woo_c-product-image.with-zoom .product_images .image-wrap') 4500 .on('mouseover', function () { 4501 $(this).find('img').css({ 'transform': 'scale(1.5)' }); 4502 }) 4503 .on('mouseout', function () { 4504 $(this).find('img').css({ 'transform': 'scale(1)' }); 4505 }) 4506 .on('mousemove', function (e) { 4507 $(this).find('img').css({ 'transform-origin': ((e.pageX - $(this).offset().left) / $(this).width()) * 100 + '% ' + ((e.pageY - $(this).offset().top) / $(this).height()) * 100 + '%' }); 4508 }) 4509 } 4510 4511 function contactFormAcceptenceField() { 4512 var acceptenceCheckbox = $('#form_privacy_policy'); 4513 4514 acceptenceCheckbox.each(function () { 4515 if ($(this).length) { 4516 $(this).parents('.wpcf7-form').find('.btn').prop('disabled', true); 4517 } 4518 }); 4519 4520 acceptenceCheckbox.on('change', function () { 4521 if ($(this).is(':checked')) { 4522 $(this).parents('.wpcf7-form').find('.btn').prop('disabled', false); 4523 } else { 4524 $(this).parents('.wpcf7-form').find('.btn').prop('disabled', true); 4525 } 4526 }); 4527 } 4528 4529 function portfolioGridType12() { 4530 var portfolioGrid = $('.grid_12'); 4531 4532 portfolioGrid.each(function () { 4533 4534 var gridHolder = $(this).find('.portfolio-grid-holder'); 4535 var gridHolderWidth = gridHolder.width(); 4536 var grid = $(this).find('.portfolio-grid'); 4537 var gridHeight = grid.width(); 4538 var gridItems = $(this).find(' .grid-item'); 4539 var filterBar = $(this).find('.portfolio-sorting'); 4540 var underline = gridHolder.find('.portfolio-grid-holder-underline'); 4541 var windwoWidth = $(window).width(); 4542 var windwoHeight = $(window).height(); 4543 4544 cloneImagesForPortfolioGridType12($(this)); 4545 var gridImages = $('.interactive-links-grid-images .portfolio-item-image'); 4546 4547 4548 if (filterBar.length) { 4549 grid.css('top', filterBar.outerHeight() + 'px'); 4550 } 4551 4552 if (!Clb.isMobile) { 4553 gridHolder.height(gridHeight); 4554 grid.css('min-height', gridHolderWidth); 4555 grid.css('max-height', gridHolderWidth); 4556 4557 setTimeout(function(){ 4558 grid.find('[data-aos-once]').addClass('aos-animate'); 4559 }, 800); 4560 4561 setTimeout(function () { 4562 underline.width(gridItems.eq(0).height()); 4563 underline.height(1); 4564 }, 300); 4565 4566 } else { 4567 setTimeout(function () { 4568 underline.height(gridItems.eq(0).height()); 4569 underline.width(1); 4570 }, 300); 4571 } 4572 4573 4574 gridItems.each(function () { 4575 var gridItem = $(this); 4576 var gridItemOffsetLeft = gridItem.offset().left; 4577 4578 var gridImage = gridImages.eq(gridItem.index()); 4579 var gridImageInnerContainer = gridImage.find('.portfolio-item-image-container'); 4580 var gridImageWidth = gridImage.width(); 4581 var gridImageHeight = gridImage.height(); 4582 4583 var lastMouseXPosition = 0; 4584 var lastMouseYPosition = 0; 4585 var moveTimer; 4586 4587 gridItem.find('.portfolio-item').on('mouseover mousemove', function (event) { 4588 4589 //If mousemove is stopped 4590 clearTimeout(moveTimer); 4591 moveTimer = setTimeout(function () { 4592 gridImageInnerContainer[0].style.transform = 'rotate(0deg)'; 4593 }, 200); 4594 4595 var y = event.clientY; 4596 var x = event.clientX; 4597 4598 var mouseYPosition = event.clientY; 4599 4600 var underlinePosition = $(this).offset().left - gridHolder.offset().left; 4601 4602 var rotateIndex = ((y - lastMouseYPosition) + (x - lastMouseXPosition)) / -1; 4603 4604 if (gridItemOffsetLeft > (windwoWidth / 2)) { 4605 x -= gridImageWidth / 2; 4606 } 4607 4608 if (mouseYPosition > (windwoHeight / 1.5)) { 4609 y -= gridImageHeight; 4610 } 4611 4612 if (Clb.isMobile) { 4613 underlinePosition = $(this).offset().top - gridHolder.offset().top; 4614 underline[0].style.transform = 'translateY(' + underlinePosition + 'px)'; 4615 } else { 4616 underline[0].style.transform = 'translateX(' + underlinePosition + 'px)'; 4617 } 4618 4619 gridImage.addClass('visible'); 4620 gridImage[0].style.transform = 'translate(' + x + 'px, ' + y + 'px' + ')'; 4621 gridImageInnerContainer[0].style.transform = 'rotate(' + rotateIndex + 'deg)'; 4622 gridImageInnerContainer[0].style.filter = 'brightnes(' + rotateIndex + ')'; 4623 4624 setTimeout(function () { 4625 gridImage.addClass('animate'); 4626 }, 1); 4627 4628 lastMouseXPosition = event.clientX; 4629 lastMouseYPosition = event.clientY; 4630 4631 }); 4632 4633 gridItem.find('.portfolio-item').on('mouseleave', function (event) { 4634 gridImage.removeClass('visible'); 4635 gridImage[0].style.transform = 'translate(0px, 0px)'; 4636 gridImageInnerContainer[0].style.transform = 'rotate(0deg)'; 4637 4638 setTimeout(function () { 4639 gridImage.removeClass('animate'); 4640 }, 1); 4641 }); 4642 4643 gridItem.on("mouseout", function () { 4644 clearTimeout(moveTimer); 4645 }); 4646 }); 4647 }); 4648 } 4649 $(window).on('ohio:portfolioGridType12', portfolioGridType12); 4650 4651 function cloneImagesForPortfolioGridType12(grid) { 4652 var gridItem = grid.find(' .grid-item'); 4653 var gridImages = $('.interactive-links-grid-images'); 4654 4655 gridImages.empty(); 4656 4657 gridItem.each(function () { 4658 var itemImage = $(this).find('.portfolio-item-image'); 4659 gridImages.append(itemImage.clone()); 4660 }); 4661 } 4662 4663 function getMaxPropertySize(elements, property) { 4664 var maxPropertySize = 0; 4665 4666 elements.each(function () { 4667 4668 var itemPropertySize = $(this).css(property).replace(/(^\d+)(.+$)/i, '$1'); 4669 4670 if (itemPropertySize > maxPropertySize) { 4671 maxPropertySize = itemPropertySize; 4672 } 4673 4674 }); 4675
4676 return maxPropertySize 4677 4678 } 4679 4680 function asymmetricParallaxGrid() { 4681 // var asymmetricGrid = $('[data-asymmetric-parallax-grid]'); 4682 4683 // if (asymmetricGrid.data('asymmetric-parallax-grid')) { 4684 // var gridItems = $('[data-asymmetric-parallax-grid]').children(); 4685 // var loopCount = 1; 4686 // var gridTop = asymmetricGrid.offset().top; 4687 // var gridHeight = asymmetricGrid.height(); 4688 // var speed = asymmetricGrid.data('asymmetric-parallax-speed') / 100; 4689 // var grid = asymmetricGrid.data('grid-number').split('-'); 4690 // var gridNumber = getGridNumber(grid); 4691 4692 // //Establish modifier for each element 4693 // if (asymmetricGrid.hasClass('ohio-masonry') || asymmetricGrid.data('isotope-grid') ) { 4694 // setTimeout(function(){ 4695 // var itemLeftOffset = 0; 4696 // var countOffsets = []; 4697 4698 // //Get offset for each column 4699 // for (var i = 0; i < gridNumber; i++ ) { 4700 // let itemLeftOffset = gridItems[i].style.left.replace(/(^\d+)(.+$)/i,'$1'); 4701 // countOffsets.push(itemLeftOffset); 4702 // } 4703 4704 // gridItems.each(function(i){ 4705 // itemLeftOffset = this.style.left.replace(/(^\d+)(.+$)/i,'$1'); 4706 // //Set data order equal 4707 // for (var i = 0; i < countOffsets.length; i++ ) { 4708 // if (itemLeftOffset == countOffsets[i]) { 4709 // $(this).data('data-order', i + 1); 4710 // $(this).data('position', 0); 4711 // } 4712 // } 4713 // }); 4714 // }, 101); 4715 // } else { 4716 // gridItems.each(function(i){ 4717 // $(this).data('data-order', loopCount); 4718 // $(this).data('position', 0); 4719 // loopCount++; 4720 4721 // if (loopCount > gridNumber) { 4722 // loopCount = 1; 4723 // } 4724 // }); 4725 // } 4726 4727 // var params = { 4728 // 'gridTop': gridTop, 4729 // 'gridHeight': gridHeight, 4730 // 'speed': speed 4731 // }; 4732 4733 // asymmetricGrid.addClass('clb-asymmetric-parallax-grid'); 4734 4735 // $(window).on('scroll mousewheel', function (e) { 4736 // handleAsymmetricParallaxGrid(params, e); 4737 // }); 4738 4739 // function getGridNumber(grid) { 4740 // if (Clb.isMobile) { 4741 4742 // if (grid[2] == 'i') { 4743 // return 1; 4744 // } 4745 4746 // return grid[2]; 4747 // } else if (Clb.isPad) { 4748 4749 // if (grid[1] == 'i') { 4750 // return 2; 4751 // } 4752 4753 // return grid[1]; 4754 // } else { 4755 4756 // if (grid[0] == 'i') { 4757 // return 3; 4758 // } 4759 4760 // return grid[0]; 4761 // } 4762 // } 4763 // } 4764 } 4765 4766 function handleAsymmetricParallaxGrid(params, e) { 4767 // var contentScroll = $(document).scrollTop(); 4768 // var wndHeight = $(window).height(); 4769 4770 // var isnotStartOrEndDocument = (contentScroll != 0) && ($(document).height() != contentScroll + $(window).height()); 4771 // var isGridOnScreen = (params['gridTop'] <= contentScroll + wndHeight) && (params['gridTop'] + params['gridHeight'] >= contentScroll); 4772 4773 // if (isGridOnScreen && isnotStartOrEndDocument) { 4774 // $('[data-asymmetric-parallax-grid] > *').each(function(){ 4775 4776 // if (e.originalEvent.wheelDelta > 0) { 4777 // var newPosition = ($(this).data('position') + (params['speed'] * ($(this).data('data-order') * 2))); 4778 // } else { 4779 // var newPosition = ($(this).data('position') - (params['speed'] * $(this).data('data-order'))); 4780 // } 4781 4782 // $(this).data('position', newPosition); 4783 // $(this).css('transform', 'translate3d(0, ' + newPosition + 'px, 0)'); 4784 // }); 4785 // } else if (!isGridOnScreen) { 4786 // $('[data-asymmetric-parallax-grid] > *').each(function(){ 4787 // $(this).css('transform', 'translate3d(0, 0, 0)'); 4788 // $(this).data('position', 0); 4789 // }); 4790 // } 4791 } 4792 4793 function handleOhioBgImages() { 4794 $('[data-ohio-bg-image]').each(function () { 4795 $(this).css('background-image', 'url(' + $(this).attr('data-ohio-bg-image') + ')'); 4796 }); 4797 } 4798 $(window).on('ohio:handle_bg_images', handleOhioBgImages); 4799 4800 function handleOhioDynamicTextSc() { 4801 $('div[data-dynamic-text="true"]').each(function () { 4802 var options = JSON.parse($(this).attr('data-dynamic-text-options')); 4803 new Typed('#' + $(this).attr('id') + ' .dynamic', options); 4804 }); 4805 } 4806 setTimeout(function () { 4807 $(window).on('ohio:handle_ohio_dynamic_text', handleOhioDynamicTextSc); 4808 }, 1000) 4809 4810 4811 percentagePreloader(); 4812 wideMenuOnLoadPosition(); 4813 4814 window.ohioRefreshFrontEnd = function () { 4815 handleAccordionBox(); 4816 handleBannerBox(); 4817 handleBannerBoxSize(); 4818 handleCounterBox(); 4819 handleCountdownBox(); 4820 handleSubscribeContactForm(); 4821 handleCoverBox(); 4822 handleCoverBoxSize(); 4823 handleGallery(); 4824 // handleSocialBar(); 4825 handleSplitboxParallax(); 4826 handleProgressBar(); 4827 handleProgressBarSize(); 4828 initParallax(); 4829 handleParallax(); 4830 handlePriceTable(); 4831 handleTabBox();
4832 handleVideoBackground(); 4833 handleVideoPopup(); 4834 handleScrollEffects(); 4835 handleSliders(); 4836 }; 4837 4838 handleMobileHeader(); 4839 $(window).on('load', function () { 4840 4841 Clb.init(); 4842 handleOhioHeight(); 4843 4844 // Navigation 4845 if (!Clb.isMobileMenu && Clb.headerIsFifth) { 4846 centeredLogo(); 4847 } 4848 handleNavigations(); 4849 4850 //countMenuItems(); 4851 4852 // Header 4853 handleHeaders(); 4854 handleHeaderTitle(); 4855 4856 4857 handleCustomSelect(); 4858 handleLanguageSelect(); 4859 4860 // Footer 4861 handleFooter(); 4862 handleFooterSize(); 4863 handleStretchContent(); 4864 4865 // Shortcodes 4866 handleAccordionBox(); 4867 handleAccordionBoxSize(); 4868 handleBannerBox(); 4869 handleBannerBoxSize(); 4870 handleCounterBox(); 4871 handleCountdownBox(); 4872 handleSubscribeContactForm(); 4873 handleCoverBox(); 4874 handleCoverBoxSize(); 4875 handleGallery(); 4876 handleFullscreenSlider(); 4877 handleCircleProgressBar(); 4878 handleTeamMemberInner(); 4879 handleHorizontalAccordion(); 4880 handleSliders(); 4881 handleStickySection(); 4882 // handleSocialBar(); 4883 handleSplitboxParallax(); 4884 handleProgressBar(); 4885 handleProgressBarSize(); 4886 initParallax(); 4887 handleParallax(); 4888 handlePriceTable(); 4889 handleTabBox(); 4890 handleVideoBackground(); 4891 handleVideoPopup(); 4892 4893 // Shop 4894 handleShopMasonry(); 4895 handleStickyProduct(); 4896 handleMobileFilter(); 4897 handleQuickviewPopup(); 4898 handleSingleProductGallery(); 4899 handleProductsGridGallery(); 4900 handleZoomProductImage(); 4901 4902 // Portfolio 4903 handlePortfolio(); 4904 if (!Clb.isPad) { 4905 handleScrollContent(); 4906 } 4907 handleScrollShareBar(); 4908 handleScrollEffects(); 4909 handleLazyLoadClick(); 4910 handleLazyLoadScroll(); 4911 handlePortfolioOnepageSlider(); 4912 handlePortfolioPopup(); 4913 handleScrollMeter(); 4914 handleMutationObserver(); 4915 if (!Clb.isPad) { 4916 handleBgParallaxEffect(); 4917 } 4918 handleBackLinkPosition(); 4919 handleRemoveSliderBulletsClass(); 4920 handleInteractiveLinksGrid(); 4921 handlePortfolioMovingDetailsGrid(); 4922 handleProjectScrollScale(); 4923 portfolioGridType12(); 4924 4925 handleMasonry(); 4926 asymmetricParallaxGrid(); 4927 contactFormAcceptenceField(); 4928 //Custom cursor 4929 if (!Clb.isPad) { 4930 handleCustomCursor(); 4931 } 4932 4933 handleDarkSectionColors(); 4934 4935 handlePageColorSwitcher(); 4936 handleGlobalPageAnimation(); 4937 boxedPageRowWidth(); 4938 4939 setTimeout(function () { 4940 handleAlignContentInStretchRow(); 4941 handleSliders(); 4942 }, 10); 4943 4944 // SlideUp animated elements 4945 $('.clb-slider-item').each(function () { 4946 if ($(this).hasClass('active')) { 4947 $(this).find('.animated-holder').addClass('visible'); 4948 } 4949 }) 4950 4951 //Buttons 4952 4953 btnPreloader(); 4954 4955 //logo SC 4956 logoOverlay(); 4957 4958 //Important for mobile menu 4959 Clb.body.addClass('page-is-loaded'); 4960 4961 // Scroll top button 4962 $('.clb-scroll-top').on("click", function () { 4963 $('html, body').animate({ scrollTop: 0 }, 800); 4964 return false; 4965 }); 4966 4967 // Tooltips 4968 $('.tooltip').each(function () { 4969 if ($(this).find('.tooltip-top, .tooltip-bottom').length) { 4970 var content = $(this).find('.tooltip-text'); 4971 content.css('left', ($(this).outerWidth() / 2 - content.outerWidth() / 2) + 'px'); 4972 } 4973 }); 4974 4975 // Message boxes 4976 $('body').on('click', '.message-box .clb-close', function () { 4977 $(this).parent().slideUp({ duration: 300, queue: false }).fadeOut(300); 4978 var self = $(this); 4979 setTimeout(function () { 4980 self.remove(); 4981 }, 350); 4982 }); 4983 4984 $('body').on('click', '.notification-bar .clb-close', function (e) { 4985 e.preventDefault(); 4986
4987 setCookie('notification', 'enabled', +ohioVariables.notification_expires); 4988 $(this).parents('.notification-bar').removeClass('active'); 4989 }); 4990 4991 // Ohio attrs 4992 handleOhioBgImages(); 4993 4994 // Fixed google maps equal height in percent 4995 $('.wpb_wrapper').each(function () { 4996 var divs = $(this).find('> div'); 4997 4998 if (divs.length == 1 && divs.eq(0).hasClass('google-maps')) { 4999 $(this).css('height', '100%'); 5000 } 5001 }); 5002 5003 handleOhioDynamicTextSc(); 5004 5005 // Refresh composter waypoints after magic 5006 if (window.vc_waypoints) { 5007 setTimeout(function () { 5008 window.vc_waypoints(); 5009 }, 600); 5010 } 5011 5012 // Mobile share button 5013 $('.mobile-social').on('click', function (e) { 5014 e.stopPropagation(); 5015 5016 if ($(this).hasClass('active')) { 5017 $(this).find('.social').css('height', '0px'); 5018 $(this).removeClass('active'); 5019 } else { 5020 var social = $(this).find('.social'); 5021 var self = $(this); 5022 5023 social.css('height', ''); 5024 5025 social.addClass('no-transition'); 5026 5027 $(this).addClass('active'); 5028 var height = social.outerHeight(); 5029 $(this).removeClass('active'); 5030 5031 setTimeout(function () { 5032 social.css('height', height + 'px'); 5033 social.removeClass('no-transition'); 5034 self.addClass('active'); 5035 }, 50); 5036 5037 } 5038 }); 5039 5040 $(window).on('scroll', function () { 5041 var handleAnim = function () { 5042 handleMobileHeader(); 5043 handleFixedHeader(); 5044 handleHeaderTitle(); 5045 handleBarScroll(); 5046 handleCounterBox(); 5047 handleProgressBar(); 5048 handleParallax(); 5049 handleScrollEffects(); 5050 handleLazyLoadScroll(); 5051 handleScrollMeter(); 5052 handleCircleProgressBar(); 5053 }; 5054 5055 if (window.requestAnimationFrame) { 5056 window.requestAnimationFrame(function () { 5057 handleAnim(); 5058 }); 5059 } else { 5060 handleAnim(); 5061 } 5062 5063 // Scroll top 5064 5065 if ($(window).scrollTop() > 250) { 5066 $('.clb-scroll-top').addClass('visible'); 5067 } else { 5068 $('.clb-scroll-top').removeClass('visible'); 5069 } 5070 }); 5071 5072 //For disebling resize trigger on mobile scroll 5073 var mobileResizeWidth = $(window).width(), mobileResizeHeight = $(window).height(); 5074 5075 $(window).on('resize', function () { 5076 Clb.resize(); 5077 handleOhioHeight(); 5078 handleHeaderSize(); 5079 handleHeaderTitle(); 5080 handleFooterSize(); 5081 handleStretchContent(); 5082 handleAccordionBoxSize(); 5083 handleBannerBoxSize(); 5084 handleCounterBox(); 5085 handleCoverBox(); 5086 handleCoverBoxSize(); 5087 handleParallax(); 5088 handleProgressBarSize(); 5089 handlePriceTable(); 5090 handleTabBoxSize(); 5091 handleProgressBar(); 5092 handleScrollEffects(); 5093 handleLazyLoadScroll(); 5094 handleShopMasonry(); 5095 handleScrollShareBar(); 5096 handleHorizontalAccordion(); 5097 handleMobileHeader(); 5098 handleTabBox(); 5099 boxedPageRowWidth(); 5100 wideMenuOnResizePosition(); 5101 5102 setTimeout(function () { 5103 handleAlignContentInStretchRow(); 5104 handleMasonry(); 5105 5106 if (Clb.isElementorPage) { 5107 handleAccordionBoxSize(); 5108 } 5109 5110 portfolioGridType12(); 5111 5112 }, 400); 5113 5114 if (!Clb.isMobileMenu && Clb.headerIsFifth && Clb.header && Clb.header.length) { 5115 if (Clb.header.hasClass('header-4')) { 5116 setTimeout(function () { 5117 Clb.header.find('.nav').removeAttr('style'); 5118 centeredLogo(); 5119 }, 100); 5120 } 5121 } 5122 5123 if (Clb.isPad) { 5124 mobileSubMenuCalcHeight(); 5125 } 5126 5127 //For disebling resize trigger on mobile scroll 5128 if ($(window).width() !== mobileResizeWidth) { 5129 handleSingleProductGallery(); 5130 handleProductsGridGallery(); 5131 handleSliders(); 5132 } 5133 5134 if (Clb.isMobileMenu) { 5135 if (Clb.headerIsFifth) { 5136 $('#site-navigation, .left-part, .right-part, .nav-item').removeAttr('style'); 5137 } 5138 } 5139 5140 if (typeof (AOS) != 'undefined') { 5141 setTimeout(function () { 5142 AOS.refresh(); 5143 }, 10); 5144 // Isotope animation 5145 setTimeout(function () { 5146 AOS.refresh(); 5147 5148 if (window.vc_waypoints) { 5149 window.vc_waypoints(); 5150 } 5151 }, 600); 5152 } 5153
5154 if ($('[data-portfolio-grid-slider]').hasClass('grid_6')) { 5155 calcHeightForOnepageItemsOverlay(); 5156 } 5157 5158 //Custom cursor 5159 if (!Clb.isPad) { 5160 handleCustomCursor(); 5161 } 5162 }); 5163 5164 $('#page-preloader:not(.percentage-preloader), .container-loading').addClass('hidden'); 5165 5166 var userAgent = navigator.userAgent.toLowerCase(); 5167 var isSafari = false 5168 5169 if (userAgent.indexOf('safari') != -1) { 5170 if (userAgent.indexOf('chrome') > -1) { 5171 isSafari = false; // Chrome 5172 } else { 5173 isSafari = true; // Safari 5174 } 5175 } 5176 5177 if (navigator.userAgent.match(/(iPod|iPhone|iPad)/) || isSafari) { 5178 window.onpageshow = function (event) { 5179 if (event.persisted) { 5180 window.location.reload(); 5181 } 5182 }; 5183 } 5184 5185 if (Clb.body.hasClass('global-page-animation')) { 5186 Clb.body.addClass('global-page-animation-active'); 5187 } 5188 5189 $('.gimg').css('opacity', '1'); 5190 5191 handleCompareShortcodes(); 5192 }); 5193 5194 // Compare SC 5195 function handleCompareShortcodes() { 5196 $('.compare-shortcode').each(function () { 5197 var $this = $(this); 5198 5199 $this.twentytwenty({ 5200 no_overlay: $this.attr('data-compare-without-overlay'), 5201 before_label: $this.attr('data-compare-before-label'), 5202 after_label: $this.attr('data-compare-after-label'), 5203 orientation: $this.attr('data-compare-orientation'), 5204 default_offset_pct: parseFloat($this.attr('data-compare-position')), 5205 }); 5206 5207 var twentyHandle = $this.find('.twentytwenty-handle'); 5208 twentyHandle.find('.twentytwenty-left-arrow, .twentytwenty-right-arrow').remove(); 5209 twentyHandle.each(function () { 5210 $(this).append('<div class="twentytwenty-arrows cursor-magnet"><i class="ion ion-ios-code"></i></div>'); 5211 }); 5212 }); 5213 } 5214 $(window).on('ohio:handle_compare_shortcodes', handleCompareShortcodes); 5215 5216 // Custom cursor 5217 function handleCustomCursor() { 5218 const cursorInnerEl = document.querySelector('.circle-cursor--inner'); 5219 const cursorOuterEl = document.querySelector('.circle-cursor--outer'); 5220 5221 if ($('body').hasClass('custom-cursor') && cursorInnerEl && cursorOuterEl) { 5222 let lastY, lastX = 0; 5223 let magneticFlag = false; 5224 5225 // move 5226 window.onmousemove = function (event) { 5227 if (!magneticFlag) { 5228 cursorOuterEl.style.transform = 'translate(' + event.clientX + 'px, ' + event.clientY + 'px' + ')'; 5229 5230 /*Old code*/ 5231 // cursorOuterEl.style.top = event.clientY + 'px'; 5232 // cursorOuterEl.style.left = event.clientX + 'px'; 5233 } 5234 cursorInnerEl.style.transform = 'translate(' + event.clientX + 'px, ' + event.clientY + 'px' + ')'; 5235 5236 /*Old code*/ 5237 // cursorInnerEl.style.top = event.clientY + 'px'; 5238 // cursorInnerEl.style.left = event.clientX + 'px'; 5239 lastY = event.clientY; 5240 lastX = event.clientX; 5241 } 5242 5243 // links hover 5244 $('body').on('mouseenter', 'a, .cursor-as-pointer', function () { 5245 cursorInnerEl.classList.add('cursor-link-hover'); 5246 cursorOuterEl.classList.add('cursor-link-hover'); 5247 }); 5248 $('body').on('mouseleave', 'a, .cursor-as-pointer', function () { 5249 if ($(this).is('a') && $(this).closest('.cursor-as-pointer').length) { 5250 return; 5251 } 5252 cursorInnerEl.classList.remove('cursor-link-hover'); 5253 cursorOuterEl.classList.remove('cursor-link-hover'); 5254 }); 5255 5256 // additional hover cursor class 5257 $('body').on('mouseenter', '[data-cursor-class]', function () { 5258 const cursorClass = $(this).attr('data-cursor-class'); 5259 // cursorInnerEl.classList.add(cursorClass); 5260 // cursorOuterEl.classList.add(cursorClass); 5261 5262 if (cursorClass.indexOf('dark-color') != -1) { 5263 cursorInnerEl.classList.add('dark-color'); 5264 cursorOuterEl.classList.add('dark-color'); 5265 } 5266 5267 if (cursorClass.indexOf('cursor-link') != -1) { 5268 cursorInnerEl.classList.add('cursor-link'); 5269 cursorOuterEl.classList.add('cursor-link'); 5270 } 5271 }); 5272 $('body').on('mouseleave', '[data-cursor-class]', function () { 5273 const cursorClass = $(this).attr('data-cursor-class'); 5274 if (cursorClass.indexOf('dark-color') != -1) { 5275 cursorInnerEl.classList.remove('dark-color'); 5276 cursorOuterEl.classList.remove('dark-color'); 5277 } 5278 5279 if (cursorClass.indexOf('cursor-link') != -1) { 5280 cursorInnerEl.classList.remove('cursor-link'); 5281 cursorOuterEl.classList.remove('cursor-link'); 5282 } 5283 }); 5284 5285 // magnet elements 5286 $('body').on('mouseenter', '.cursor-magnet, .btn-round', function () { 5287 const $elem = $(this); 5288 const scrollTop = window.pageYOffset || document.documentElement.scrollTop; 5289 5290 cursorOuterEl.style.transition = 'all .2s ease-out'; 5291 cursorOuterEl.style.transform = 'translate(' + $elem.offset().left + 'px, ' + ($elem.offset().top - scrollTop) + 'px' + ')'; 5292 5293 /*Old code*/ 5294 // cursorOuterEl.style.top = ($elem.offset().top - scrollTop) + 'px'; 5295 // cursorOuterEl.style.left = $elem.offset().left + 'px'; 5296 cursorOuterEl.style.width = $elem.width() + 'px'; 5297 cursorOuterEl.style.height = $elem.height() + 'px'; 5298 cursorOuterEl.style.marginLeft = 0; 5299 cursorOuterEl.style.marginTop = 0; 5300 5301 magneticFlag = true; 5302 }); 5303 5304 $('body').on('mouseleave', '.cursor-magnet, .btn-round', ohioRemoveMagneticFromCursor); 5305 5306 function ohioRemoveMagneticFromCursor() { 5307 cursorOuterEl.style.transition = null; 5308 cursorOuterEl.style.width = null; 5309 cursorOuterEl.style.height = null; 5310 cursorOuterEl.style.marginLeft = null; 5311 cursorOuterEl.style.marginTop = null; 5312 5313 /*Old code*/ 5314 // cursorOuterEl.style.top = lastY + 'px'; 5315 // cursorOuterEl.style.left = lastX + 'px'; 5316 5317 magneticFlag = false;
5318 } 5319 5320 // Custom leave trigger 5321 $('body').on('ohio:cursor_mouseleave', function () { 5322 ohioRemoveMagneticFromCursor(); 5323 5324 cursorOuterEl.style.transform = cursorInnerEl.style.transform; 5325 5326 cursorInnerEl.classList.remove('cursor-link-hover'); 5327 cursorOuterEl.classList.remove('cursor-link-hover'); 5328 5329 }); 5330 5331 //iframe fix 5332 $('body').on('mouseenter', 'iframe', function () { 5333 cursorOuterEl.style.visibility = 'hidden'; 5334 cursorInnerEl.style.visibility = 'hidden'; 5335 }); 5336 $('body').on('mouseleave', 'iframe', function () { 5337 cursorOuterEl.style.visibility = 'visible'; 5338 cursorInnerEl.style.visibility = 'visible'; 5339 }); 5340 5341 cursorInnerEl.style.visibility = 'visible'; 5342 cursorOuterEl.style.visibility = 'visible'; 5343 } 5344 } 5345 5346 if ($('body').hasClass('ohio-anchor-onepage')) { 5347 $('body #masthead a:not(.hamburger-holder):not(.search-global )').on('click', function (event) { 5348 5349 if ($(this).attr('href').includes('#')) { 5350 event.preventDefault(); 5351 var href = '#' + $(this).attr('href').split('#')[1]; 5352 5353 if ($(href).length) { 5354 $('html, body').animate({ 5355 scrollTop: $(href).offset().top 5356 }, 500, function () { 5357 window.location.hash = href; 5358 }); 5359 } 5360 5361 return false; 5362 } 5363 }); 5364 5365 if (window.location.hash.substring(0, 1) == '#') { 5366 if ($(window.location.hash).length) { 5367 $('html, body').animate({ 5368 scrollTop: $(window.location.hash).offset().top 5369 }, 500); 5370 } 5371 } 5372 } 5373 5374 /* Breadcrumbs filters handler */ 5375 $('.filter .select-inline select').change(function () { 5376 let $selected = $(this).find('option:selected'); 5377 if ($selected.attr('data-select-href')) { 5378 window.location.assign($selected.attr('data-select-href')); 5379 } 5380 }); 5381 5382})(jQuery); 5383 5384// Hack for elementor parallax fix 5385jQuery(window).on('load', function () { 5386 if (jQuery('.elementor-motion-effects-container').length) { 5387 setTimeout(function () { 5388 window.dispatchEvent(new Event('resize')); 5389 }, 500); 5390 } 5391}); 5392 5393// Elementor 5394jQuery(window).on('elementor/frontend/init', function () { 5395 jQuery(window).trigger('ohio:handle_global_page_animation'); 5396});
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.