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 1317 $('[data-ohio-slider-simple]').each(function () { 1318 var carousel = $(this); 1319 1320 carousel.clbSlider({ 1321 dots: false, 1322 verticalScroll: false, 1323 loop: true, 1324 autoHeight: true 1325 }).on('clb-slider.changed', function () { 1326 setTimeout(function () { 1327 $('.ohio-masonry').masonry(); 1328 }, 250); 1329 }); 1330 }); 1331 } 1332 $(window).on('ohio:handle_sliders', handleSliders); 1333 1334 function handleFullscreenSlider() { 1335 var onepage = $('.fullscreen-slider'); 1336 if (onepage.length) { 1337 1338 if (onepage.find('.ohio-dynamic-text-sc ')) { 1339 handleOhioDynamicTextSc(); 1340 } 1341 1342 var options = JSON.parse(onepage.attr('data-options')); 1343 1344 onepage.clbSlider(options); 1345 1346 var onepageOffset = onepage.offset().top; 1347 var onepageHeight = onepage.height(); 1348 1349 var divNav = $('#mega-menu-wrap > ul > li > a, #masthead .menu-optional > li a, #masthead .ion:not(.ion-md-add)'); 1350 var pagination = onepage.find('.clb-slider-nav-btn .btn-round, .clb-slider-pagination .clb-slider-page'); 1351 var dots = onepage.find('.clb-slider-nav-dots .clb-slider-dot'); 1352 var social = $('.clb-social-holder li'); 1353 var search = $('.search-global'); 1354 var scroll = $('.clb-scroll-top'); 1355 1356 onepage.on('clb-slider.changed', function () { 1357 var item = onepage.find('.clb-slider-outer-stage > .clb-slider-stage > .clb-slider-item.active'); 1358 var activedot = onepage.find('.clb-slider-nav-dots .clb-slider-dot.active'); 1359 1360 var paginationColor = item.data('pagination-color'); 1361 var menuColor = item.data('header-nav-color'); 1362 var socialColor = item.data('social-networks-color'); 1363 var searchColor = item.data('search-color'); 1364 var scrollColor = item.data('scroll-to-top-color'); 1365 var logoType = item.data('header-logo-type'); 1366 1367 divNav.css('transition', 'none'); 1368 pagination.css('transition', 'none'); 1369 dots.css('transition', 'none'); 1370 activedot.css('transition', 'none'); 1371 social.css('transition', 'none'); 1372 search.find('.ion').css('transition', 'none'); 1373 scroll.css('transition', 'none'); 1374 1375 divNav.css('color', menuColor ? menuColor : ''); 1376 pagination.css('color', (paginationColor) ? paginationColor : ''); 1377 dots.css('color', (paginationColor) ? paginationColor : ''); 1378 activedot.css('border-color', (paginationColor) ? paginationColor : ''); 1379 social.css('color', (socialColor) ? socialColor : ''); 1380 search.css('color', (searchColor) ? searchColor : ''); 1381 scroll.css('color', (scrollColor) ? scrollColor : ''); 1382 1383 if (logoType) {
1384 if (Clb.logo.length && Clb.fixedLogo.length) { 1385 $([Clb.logo[0], Clb.fixedLogo[0]]).css({ 1386 'position': 'absolute', 1387 'width': '0px', 1388 'height': '0px', 1389 'overflow': 'hidden' 1390 }); 1391 } 1392 1393 if (logoType == 'dark' && Clb.logoForOnepageDark) { 1394 if (Clb.logoForOnepageLight) { 1395 Clb.logoForOnepageLight.addClass('hidden'); 1396 } 1397 Clb.logoForOnepageDark.removeClass('hidden'); 1398 } 1399 if (logoType == 'light' && Clb.logoForOnepageLight) { 1400 if (Clb.logoForOnepageDark) { 1401 Clb.logoForOnepageDark.addClass('hidden'); 1402 } 1403 Clb.logoForOnepageLight.removeClass('hidden'); 1404 } 1405 } else { 1406 defaultLogo(); 1407 } 1408 1409 setTimeout(function () { 1410 divNav.css('transition', ''); 1411 pagination.css('transition', ''); 1412 dots.css('transition', ''); 1413 activedot.css('transition', ''); 1414 social.css('transition', ''); 1415 search.find('.ion').css('transition', ''); 1416 scroll.css('transition', ''); 1417 }, 300); 1418 }); 1419 1420 if ($(window).scrollTop() > (onepageOffset) || $(window).scrollTop() < onepageOffset) { 1421 toggleSliderScrollBar('hide-all'); 1422 } 1423 1424 $(window).on('scroll', function () { 1425 if ($(window).scrollTop() > (onepageOffset + onepageHeight) || $(window).scrollTop() < onepageOffset) { 1426 divNav.css('color', ''); 1427 defaultLogo(); 1428 } 1429 1430 if ($(window).scrollTop() > (onepageOffset) || $(window).scrollTop() < onepageOffset) { 1431 toggleSliderScrollBar('hide'); 1432 } else { 1433 toggleSliderScrollBar('show'); 1434 } 1435 }); 1436 } 1437 1438 function defaultLogo() { 1439 if (Clb.logoForOnepageDark) { 1440 Clb.logoForOnepageDark.addClass('hidden'); 1441 } 1442 if (Clb.logoForOnepageLight) { 1443 Clb.logoForOnepageLight.addClass('hidden'); 1444 } 1445 $([Clb.logo[0], Clb.fixedLogo[0]]).css({ 1446 'position': '', 1447 'width': '', 1448 'height': '', 1449 'overflow': '' 1450 }); 1451 } 1452 } 1453 $(window).on('ohio:handle_fullscreen_sliders', handleFullscreenSlider); 1454 1455 function toggleSliderScrollBar(toggle) { 1456 var scrollTop = $('.clb-scroll-top:not(.clb-slider-scroll-top)'); 1457 var sliderSCrollTop = $('.clb-slider-scroll-top '); 1458 1459 if (toggle == 'show') { 1460 scrollTop.addClass('invisible').removeClass('visible'); 1461 sliderSCrollTop.addClass('visible').removeClass('invisible'); 1462 } else if (toggle == 'hide') { 1463 scrollTop.addClass('visible').removeClass('invisible'); 1464 sliderSCrollTop.addClass('invisible').removeClass('visible'); 1465 } else if (toggle == 'hide-all') { 1466 scrollTop.addClass('invisible').removeClass('visible'); 1467 sliderSCrollTop.addClass('invisible').removeClass('visible'); 1468 } 1469 } 1470 /* ## Tabs */ 1471 1472 function handleTabBox() { 1473 $('[data-ohio-tab-box]').each(function () { 1474 var box = $(this); 1475 var buttons = $(this).find('.tabNav_link'); 1476 var buttonsWrap = $(this).find('.tabNav'); 1477 var line = $(this).find('.tabNav .tabNav_line'); 1478 var items = $(this).find('.tabItems_item'); 1479 var options = (box.attr('data-options')) ? JSON.parse(box.attr('data-options')) : {}; 1480 var nextBtn = $(this).find('.next-btn:not(.btn-round)'); 1481 var tabOffset = box.offset().top; 1482 1483 // Initializtion 1484 if (buttons.length == 0) { 1485 items.each(function () { 1486 var title = $(this).attr('data-title'); 1487 box.find('.tabNav').append($(document.createElement('li')).addClass('tabNav_link ' + options.tabClass).html(title)); 1488 }); 1489 buttons = $(this).find('.tabNav_link'); 1490 buttons.eq(0).addClass('active ' + options.tabActiveClass); 1491 } 1492 1493 if (!box.find('.tabItems_item.active').length) { 1494 items.eq(0).addClass('active'); 1495 } 1496 1497 items.addClass(options.itemClass); 1498 1499 1500 // Process 1501 var refresh = function () { 1502 // Height 1503 var activeItem = box.find('.tabItems_item.active'); 1504 if (box.hasClass('vertical') && buttonsWrap.outerHeight() > activeItem.outerHeight()) { 1505 box.find('.tabItems').css('height', activeItem.outerHeight() + 'px'); 1506 } else { 1507 box.find('.tabItems').css('height', activeItem.outerHeight() + 'px'); 1508 } 1509 1510 // Line 1511 var active = box.find('.tabNav .active'); 1512 if (box.hasClass('vertical') && !Clb.isMobile) { 1513 line.css({ 1514 'height': active.outerHeight() + 'px', 1515 'transform': 'translateY(' + (active.offset().top - buttonsWrap.offset().top) + 'px)' 1516 }); 1517 } else { 1518 line.css({ 1519 'width': active.outerWidth() + 'px', 1520 'transform': 'translateX(' + (active.offset().left - buttonsWrap.offset().left + buttonsWrap.scrollLeft()) + 'px)' 1521 }); 1522 } 1523 }; 1524 1525 buttons.on('click', function () { 1526 buttons.removeClass('active ' + options.tabActiveClass).addClass(options.tabClass); 1527 items.removeClass('active'); 1528 1529 $(this).addClass('active ' + options.tabActiveClass); 1530 items.eq($(this).index() - 1).addClass('active'); 1531 1532 refresh(); 1533 }); 1534 1535 var nextTab = function (element) { 1536 1537 element.each(function (i) { 1538 if (element.eq(i).hasClass('active')) { 1539 element.eq(i).removeClass('active'); 1540 element.eq(i).next().addClass('active ' + options.tabActiveClass); 1541 return false;
1542 } 1543 }); 1544 } 1545 1546 if ($('#masthead[data-header-fixed]').length) { 1547 tabOffset -= 70; 1548 } 1549 1550 nextBtn.on('click', function () { 1551 event.preventDefault(); 1552 nextTab(buttons); 1553 nextTab(items); 1554 refresh(); 1555 $('body, html').animate({ scrollTop: tabOffset }, 500); 1556 1557 }); 1558 1559 //Single product smooth scroll to review 1560 $(".write-review, .woo-review-link").on("click", function (event) { 1561 productReviewSmoothScroll(event); 1562 }); 1563 1564 if (window.location.href.includes('#product_review')) { 1565 productReviewSmoothScroll(); 1566 } 1567 1568 function productReviewSmoothScroll(event) { 1569 if (event) { 1570 event.preventDefault(); 1571 } 1572 1573 var tab = $('#product_review'); 1574 1575 tab.find('.tabNav_link').removeClass('active'); 1576 tab.find('.tabItems_item').removeClass('active'); 1577 1578 var top = tab.offset().top; 1579 $('body,html').animate({ scrollTop: (top) }, 700); 1580 1581 tab.find('.tabNav_link[data-ohio-tab="reviews"]').addClass('active'); 1582 tab.find('.tabItems_item[data-ohio-tab-content="reviews"]').addClass('active'); 1583 1584 refresh(); 1585 } 1586 1587 refresh(); 1588 1589 }); 1590 }; 1591 $(window).on('ohio:handle_tab_box', handleTabBox); 1592 1593 function handleTabBoxSize() { 1594 $('[data-ohio-tab-box]').each(function () { 1595 var box = $(this); 1596 var activeItem = box.find('tabItems_item.active'); 1597 var buttonsWrap = box.find('.tabNav'); 1598 1599 if (box.hasClass('vertical') && buttonsWrap.outerHeight() > activeItem.outerHeight()) { 1600 box.find('.tabItems_item').css('height', activeItem.outerHeight() + 'px'); 1601 } else { 1602 box.find('.tabItems_item').css('height', activeItem.outerHeight() + 'px'); 1603 } 1604 }); 1605 }; 1606 $(window).on('ohio:handle_tab_box_size', handleTabBoxSize); 1607 1608 /* ## Video Background */ 1609 1610 function handleVideoBackground() { 1611 $('[data-arg-video-bg]').each(function () { 1612 var videoLink = $(this).attr('data-arg-video-bg'); 1613 var iframe = $(document.createElement('iframe')); 1614 1615 iframe.addClass('arg-video-bg').attr('src', videoLink); 1616 $(this).append(iframe); 1617 }); 1618 } 1619 1620 /* ## Theme popup */ 1621 function handlePopup(data) { 1622 $(data).each(function () { 1623 // Activate popup 1624 $(this).addClass('visible'); 1625 $(this).find('.btn-loading-disabled').addClass('btn-loading'); 1626 }); 1627 1628 1629 // setTimeout(function () { 1630 // popup.addClass('open'); 1631 // }, 30); 1632 } 1633 1634 $(document).on('keydown', function (e) { 1635 var popup = $('.clb-popup'); 1636 1637 if (e.keyCode == 27) { 1638 closePopup(popup); 1639 } 1640 }); 1641 1642 $('body').on('click keydown', '.clb-popup .clb-close, .clb-popup .subscribe-nothanks-btn', function (e) { 1643 e.preventDefault(e); 1644 var popup = $(this).closest('.clb-popup'); 1645 closePopup(popup); 1646 }); 1647 1648 function closePopup(popup) { 1649 // Close button 1650 setTimeout(function () { 1651 popup.removeClass('visible'); 1652 popup.find('.clb-popup-holder').empty(); 1653 popup.find('.clb-popup-holder').removeClass().addClass('clb-popup-holder'); 1654 1655 if ($('.site-footer.sticky').length && !Clb.isMobile && Clb.header && Clb.head.length) { 1656 Clb.header.css('z-index', '1000'); 1657 } 1658 }, 200); 1659 1660 } 1661 1662 /* ## Video popup */ 1663 function handleVideoPopup() { 1664 $(document).on('click', '.video-module', function (event) { 1665 event.preventDefault(); 1666 handlePopup('.clb-popup.custom-popup'); 1667 var popupInner = $('.clb-popup-holder').addClass('clb-video-popup'); 1668 popupInner.siblings('.btn-loading-disabled').removeClass('btn-loading'); 1669 var autoplay = $(this).attr('data-video-module-autoplay') ? 1 : 0; 1670 1671 // Append video 1672 popupInner.append($(document.createElement("iframe")).attr({ 1673 'src': $(this).attr('data-video-module') + "?autoplay=" + autoplay + "", 1674 'allowfullscreen': 'true', 1675 'frameborder': '0' 1676 })); 1677 1678 setTimeout(function () { 1679 $('.clb-popup').removeClass('container-loading'); 1680 }, 1000) 1681 }); 1682 } 1683 1684 /* ## Product quickview */ 1685 1686 function handleQuickviewPopup(items) { 1687 var link; 1688 1689 if (items === undefined) { 1690 link = $('.quickview-link'); 1691 } else { 1692 link = items.find('.quickview-link'); 1693 } 1694 1695 link.on("click", function (event) { 1696 event.preventDefault 1697 Clb.containerLoading.removeClass('hidden'); 1698 handlePopup('.clb-popup.custom-popup'); 1699 var link = $(this); 1700 1701 $.ajax({ 1702 url: ohioVariables.url, 1703 data: { 1704 action: 'ohio_product_modal', 1705 product_id: $(this).attr('data-product-id'), 1706 }, 1707 dataType: 'html', 1708 type: 'POST', 1709 success: function (data) { 1710 var popupInner = $('.custom-popup .clb-popup-holder').addClass('clb-popup-product'); 1711 popupInner.siblings('.btn-loading-disabled').removeClass('btn-loading'); 1712 popupInner.append(data); 1713 1714 // Add link for title 1715 var productTitle = $('.clb-popup-product .woo_c-product-details-title'); 1716 var productLink = link.parent().find('.slider a'); 1717 1718 productTitle.wrap('<div class="product-popup-title-link"><a href=' + productLink.attr('href') + ' target="_blank"></a></div>'); 1719 1720 Clb.containerLoading.addClass('hidden'); 1721 btnPreloader(); 1722 handleCustomSelect(); 1723 setTimeout(function () { 1724 handleSingleProductGallery(popupInner.find('.woo_c-product'), popupInner.find('.post-' + link.attr('data-product-id') + '')); 1725 }, 50); 1726 1727 popupInner.find('.woo_c-product-details-variations').wc_variation_form(); 1728 } 1729 }); 1730 }); 1731 } 1732 1733 // function popup_counter(event) { 1734 // var element = event.target; 1735 // var items = event.item.count; 1736 // var item = event.item.index + 1; 1737 // $('.numbers_slides').html(item + " / " + items) 1738 // } 1739 1740 /* # Portfolio */ 1741 1742 function handlePortfolio() { 1743 // Filter
1744 $('[data-ohio-portfolio-grid]').each(function () { 1745 var portfolioGrid = $(this); 1746 var isotopeGrid = $(this).find('[data-isotope-grid]'); 1747 var filterbar = $(this).find('[data-filter="portfolio"]'); 1748 var gridItem = portfolioGrid.find('.grid-item:not(.double-width)'); 1749 var itemWidth = (gridItem.length) ? gridItem[0].getBoundingClientRect().width : 0; 1750 1751 if (isotopeGrid.isotope) { 1752 setTimeout(function () { 1753 if (portfolioGrid.find('.grid-item').length == portfolioGrid.find('.double-width').length) { 1754 isotopeGrid.isotope({ 1755 percentPosition: true, 1756 masonry: { 1757 columnWidth: '.grid-item' 1758 } 1759 }); 1760 } else { 1761 isotopeGrid.isotope({ 1762 percentPosition: true, 1763 masonry: { 1764 columnWidth: '.grid-item:not(.double-width)' 1765 } 1766 }); 1767 } 1768 }, 10); 1769 1770 } else { 1771 console.log('Isotope Grid is undefined'); 1772 } 1773 1774 // Generate category numbers 1775 if (filterbar.attr('data-filter-paged')) { 1776 filterbar.find('a').each(function () { 1777 var category = $(this).attr('data-isotope-filter'); 1778 1779 var number = (category == '*') ? isotopeGrid.find('> div').length : isotopeGrid.find(category).length; 1780 1781 if (number < 10) { 1782 number = '0' + number; 1783 } 1784 1785 $(this).find('.num').html(number); 1786 }); 1787 } 1788 1789 filterbar.find('a').on('click', function () { 1790 filterbar.find('.active').removeClass('active'); 1791 $(this).addClass('active'); 1792 1793 if (isotopeGrid.isotope) { 1794 isotopeGrid.isotope({ 1795 filter: $(this).attr('data-isotope-filter'), 1796 masonry: { 1797 percentPosition: true, 1798 columnWidth: itemWidth, 1799 itemSelector: '.grid-item:not(.double-width)', 1800 } 1801 }); 1802 } 1803 1804 setTimeout(function () { 1805 if (typeof (AOS) != 'undefined') { 1806 AOS.refresh(); 1807 } 1808 if (window.vc_waypoints) { 1809 window.vc_waypoints(); 1810 } 1811 if (portfolioGrid.find('.lazy-load').length) { 1812 if (isFilterItemsHidden(portfolioGrid)) { 1813 lazyLoad($('[data-lazy-load]')); 1814 } 1815 } 1816 }, 600); 1817 portfolioGridType12(); 1818 return false; 1819 }); 1820 1821 $('body').on('ohio:lazy_load_complete', function () { 1822 portfolioGrid.find('.lazy-load').removeClass('is-loading'); 1823 portfolioGrid.find('.portfolio-grid').removeClass('is-loading'); 1824 }); 1825 1826 if (window.location.hash) { 1827 filterbar.find('a[href="' + window.location.hash + '"]').trigger('click'); 1828 } 1829 }); 1830 } 1831 1832 function isFilterItemsHidden(portfolioGrid) { 1833 var isHidden = false; 1834 var counter = 0; 1835 var itemsPerPage = $("[data-projects-per-page]").data('projects-per-page'); 1836 var categoryCount = portfolioGrid.find('[data-category-count].active').data('category-count'); 1837 var lazyLoadPagination = portfolioGrid.find(".lazy-load"); 1838 lazyLoadPagination.addClass('is-loading'); 1839 portfolioGrid.find('.portfolio-grid').addClass('is-loading'); 1840 1841 $('[data-ohio-portfolio-grid]').each(function () { 1842 var gridItems = $(this).find('[data-filter="portfolio"]').next().find(".grid-item"); 1843 1844 gridItems.each(function () { 1845 console.log(portfolioGrid.find('[data-category-count].active')) 1846 if ($(this)[0].style.display == "none") { 1847 isHidden = true; 1848 } else { 1849 counter++; 1850 1851 if (counter >= itemsPerPage || counter == categoryCount) { 1852 isHidden = false;
1853 lazyLoadPagination.removeClass('is-loading'); 1854 portfolioGrid.find('.portfolio-grid').removeClass('is-loading'); 1855 return isHidden; 1856 } 1857 } 1858 }); 1859 }); 1860 1861 return isHidden; 1862 } 1863 1864 $(window).on('ohio:handle_portfolio', handlePortfolio); 1865 1866 function handlePortfolioPopup() { 1867 var portfolioPopupSlider = $('.clb-portfolio-lightbox-media .slider'); 1868 1869 var loopSetting = Boolean(portfolioPopupSlider.attr('data-slider-loop')), 1870 navSetting = Boolean(portfolioPopupSlider.attr('data-slider-navigation')), 1871 bulletsSetting = Boolean(portfolioPopupSlider.attr('data-slider-dots')), 1872 paginationSetting = Boolean(portfolioPopupSlider.attr('data-slider-pagination')), 1873 mousescrollSetting = Boolean(portfolioPopupSlider.attr('data-slider-mousescroll')), 1874 autoplaySetting = Boolean(portfolioPopupSlider.attr('data-slider-autoplay')), 1875 autoplayTimeSetting = portfolioPopupSlider.attr('data-slider-autoplay-time'); 1876 1877 1878 $('[data-clb-portfolio-lightbox-slider]').each(function () { 1879 if (!$(this).hasClass('clb-slider')) { 1880 $(this).clbSlider({ 1881 dots: bulletsSetting, 1882 pagination: paginationSetting, 1883 mousewheel: mousescrollSetting, 1884 autoplay: autoplaySetting, 1885 autoplayTimeout: autoplayTimeSetting, 1886 loop: loopSetting, 1887 navBtn: navSetting, 1888 drag: true, 1889 }); 1890 } 1891 }); 1892 1893 portfolioPopupSlider.find('.clb-slider-nav-btn .btn-round').removeClass('btn-round-light'); 1894 1895 $('.btn-lightbox, .btn-lightbox-init').on('click', function (e) { 1896 e.preventDefault(); 1897 var portfolioItemId = $(this).parents('.portfolio-item').attr('data-portfolio-popup'); 1898 1899 if (portfolioItemId != undefined) { 1900 loadLightboxGallery.call(document.querySelector('#' + portfolioItemId)); 1901 handlePopup('#' + portfolioItemId); 1902 } 1903 1904 }); 1905 } 1906 $(window).on('ohio:handle_portfolio_popup', handlePortfolioPopup); 1907 1908 function loadLightboxGallery() { 1909 if (!this.getAttribute('data-lightbox-loaded')) { 1910 var self = this; 1911 var stage = self.querySelector('.clb-portfolio-lightbox-media'); 1912 var loaded = 0; 1913 1914 stage.classList.add('container-loading'); 1915 1916 $(this).find('[data-ohio-lightbox-image]').each(function () { 1917 var originalImage = this; 1918 var image = new Image(); 1919 image.src = originalImage.getAttribute('data-ohio-lightbox-image'); 1920 image.onload = function () { 1921 originalImage.style.backgroundImage = "url(" + image.src + ")"; 1922 loaded++; 1923 1924 if (loaded === $(self).find('[data-ohio-lightbox-image]').length) { 1925 stage.classList.remove('container-loading'); 1926 self.setAttribute('data-lightbox-loaded', true); 1927 } 1928 } 1929 }); 1930 } 1931 } 1932 1933 /* ## Scroll content */ 1934 function handleScrollContent() { 1935 $('[data-ohio-content-scroll]').each(function () { 1936 var content = $(this), 1937 parent = $($(this).attr('data-ohio-content-scroll')), 1938 timeout = null, startTop = 0, 1939 contentLeft = 0, 1940 minWidth = 768, 1941 header = $('#masthead[data-header-fixed]'), 1942 subheader = $('.subheader'), 1943 wpadminbar = $('#wpadminbar'), 1944 headerSpacer = $('.full-top-position').length ? 130 : 0; 1945 var refresh = function () { 1946 var scrollTop = $(window).scrollTop(); 1947 1948 if (header.length) { 1949 scrollTop += header.outerHeight(); 1950 1951 if (subheader.length) { 1952 scrollTop += subheader.outerHeight(); 1953 } 1954 } 1955 1956 if ($('#wpadminbar').length) { 1957 scrollTop += $('#wpadminbar').outerHeight(); 1958 } 1959 1960 if ($(window).width() >= minWidth && content.outerHeight() < parent.outerHeight()) { 1961 // scroll start 1962 1963 if (scrollTop > startTop) { 1964 var headerTop = 0; 1965 if (header.length) { 1966 headerTop += header.outerHeight(); 1967 1968 if (subheader.length) { 1969 headerTop += subheader.outerHeight(); 1970 } 1971 } 1972 1973 if ($('#wpadminbar').length) { 1974 headerTop += $('#wpadminbar').outerHeight(); 1975 } 1976 content.css({ 1977 'max-width': (content.outerWidth()) + 'px', 1978 'position': 'fixed', 1979 'top': headerTop + 'px', 1980 'left': contentLeft + 'px' 1981 }); 1982 } else { 1983 content.css({ 1984 'max-width': 'none', 1985 'position': 'relative', 1986 'top': '0px', 1987 'left': '0px' 1988 }); 1989 } 1990 // scroll end 1991 if (scrollTop + content.outerHeight() > parent.offset().top + parent.outerHeight()) { 1992 var top = parent.outerHeight() - content.outerHeight() - headerSpacer; 1993 1994 content.css({ 1995 'max-width': 'none', 1996 'position': 'relative', 1997 'top': (top) + 'px', 1998 'left': '0' + 'px' 1999 }); 2000 } 2001 } else { 2002 content.css({ 2003 'max-width': 'none', 2004 'position': 'relative', 2005 'top': '0px', 2006 'left': '0px' 2007 }); 2008 } 2009 }; 2010 2011 var resize = function () { 2012 content.css('position', 'static'); 2013 2014 contentLeft = content.offset().left; 2015 startTop = content.offset().top; 2016 2017 clearTimeout(timeout); 2018 timeout = setTimeout(function () { 2019 content.css({ 2020 'position': 'absolute', 2021 'top': (content.offset().top - parent.offset().top) + 'px', 2022 'left': (content.offset().left - parent.offset().left) + 'px' 2023 }); 2024 refresh(); 2025 }, 30); 2026 }; 2027 2028 setTimeout(function () { resize(); }, 100); 2029 2030 if (content.data('ohio-content-scroll') == '#checkout-content-scroll') { 2031 2032 $('.checkout').on('checkout_place_order', function () { 2033 setTimeout(function () { 2034 resize(); 2035 }, 2000); 2036 }); 2037 2038 $(window).on('scroll', refresh); 2039 2040 } else { 2041 $(window).on('scroll', refresh); 2042 } 2043 2044 var windowWidth = $(window).width(); 2045 $(window).on('resize', function () { 2046
2047 if (!$('.woo_c-product.single-product').length) { 2048 resize(); 2049 } else { 2050 if (windowWidth != $(window).width()) { 2051 resize(); 2052 windowWidth = $(window).width(); 2053 } 2054 } 2055 }); 2056 }); 2057 } 2058 2059 // ## Shop masonry 2060 2061 function handleShopMasonry() { 2062 var shopMasonry = $('[data-shop-masonry]'); 2063 if (!Clb.isElementorPage) { 2064 shopMasonry.each(function () { 2065 2066 var product = $(this).find('> li.product'); 2067 2068 if (shopMasonry && !shopMasonry.parents('.shop-product-type_3').length && product.length > 1) { 2069 shopMasonry.masonry({ 2070 percentPosition: true, 2071 columnWidth: ' .product:not(.double_width)' 2072 }); 2073 } 2074 }) 2075 } 2076 } 2077 2078 /* # Product */ 2079 2080 /* ## Ajax cart */ 2081 2082 jQuery(function ($) { 2083 2084 $(".input-text.qty.text").on('keyup mouseup', function () { 2085 var value = $(this).val(); 2086 $("#product_quantity").val(value) 2087 }); 2088 2089 $(document).on('click', '.single_add_to_cart_button', function (e) { 2090 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; 2091 2092 e.preventDefault(); 2093 2094 var $variation_form = $(this).closest('.variations_form'); 2095 2096 if (!$variation_form.length) { 2097 $variation_form = $('.variations_form'); 2098 } 2099 2100 var var_id = $variation_form.find('input[name=variation_id]').val(); 2101 var product_id = $variation_form.find('input[name=product_id]').val(); 2102 var quantity = $variation_form.find('input[name=quantity]').val(); 2103 2104 $('.ajaxerrors').remove(); 2105 var item = {}, 2106 check = true; 2107 var variations = $variation_form.find('select[name^=attribute]'); 2108 if (!variations.length) { 2109 variations = $variation_form.find('[name^=attribute]:checked'); 2110 } 2111 if (!variations.length) { 2112 variations = $variation_form.find('input[name^=attribute]'); 2113 } 2114 2115 variations.each(function () { 2116 var $this = $(this), 2117 attributeName = $this.attr('name'), 2118 attributevalue = $this.val(), 2119 index, 2120 attributeTaxName; 2121 $this.removeClass('error'); 2122 2123 if (attributevalue.length === 0) { 2124 index = attributeName.lastIndexOf('_'); 2125 attributeTaxName = attributeName.substring(index + 1); 2126 $this.addClass('required error'); 2127 2128 if (!$this.parent().find('.please-select-message').length) { 2129 $this.before('<span class="please-select-message">' + $variation_form.data('please-select-message') + ' ' + attributeTaxName + '</span>') 2130 } 2131 2132 check = false; 2133 } else { 2134 item[attributeName] = attributevalue; 2135 } 2136 }); 2137 2138 if (!check) { 2139 if ($(this).hasClass('sticky-product-cart')) { 2140 $(this).removeClass('btn-loading'); 2141 alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text); 2142 } 2143 2144 return false; 2145 } 2146 2147 var $thisbutton = $(this); 2148 2149 if ($thisbutton.is('.single_add_to_cart_button')) { 2150 $thisbutton.removeClass('added'); 2151 $thisbutton.addClass('loading'); 2152 // if ($thisbutton.parents(".variations_form")[0]) { 2153 // var product_id = $variation_form.find('input[name=product_id]').val(); 2154 // var quantity = $variation_form.find('input[name=quantity]').val(); 2155 // var data = { 2156 // action: 'ohio_ajax_add_to_cart_woo', 2157 // product_id: product_id, 2158 // quantity: quantity, 2159 // variation_id: var_id, 2160 // variation: item 2161 // }; 2162 // } else {
2163 // if ($thisbutton.closest('.woocommerce-add-to-cart').length > 0) { 2164 // var product_id = $thisbutton.closest('.woocommerce-add-to-cart').find("input[name=product_id]").val(); 2165 // var quantity = $thisbutton.closest('.woocommerce-add-to-cart').find("input[name=quantity]").val(); 2166 // var data = { 2167 // action: 'ohio_ajax_add_to_cart_woo_single', 2168 // product_id: product_id, 2169 // quantity: quantity 2170 // }; 2171 // } else { 2172 // var product_id = $thisbutton.siblings("input[name=product_id]").val(); 2173 // var data = { 2174 // action: 'ohio_ajax_add_to_cart_woo_single', 2175 // product_id: product_id, 2176 // quantity: 1 2177 // }; 2178 // } 2179 // } 2180 2181 if ($('form.cart').hasClass('woo_c-cart-form')) { 2182 var serializeFormFields = $('form.cart').serializeArray(); 2183 2184 var data = {}; 2185 $(serializeFormFields).each(function (index, obj) { 2186 data[obj.name] = obj.value; 2187 }); 2188 2189 data.action = 'ohio_ajax_add_to_cart_woo'; 2190 2191 if ($thisbutton.is('.sticky-product-cart')) { 2192 if ($('.single_variation_wrap').length && $('.single_variation_wrap').find('.single_add_to_cart_button.wc-variation-is-unavailable').length) { 2193 alert($thisbutton.data('unavailable-message')); 2194 $thisbutton.removeClass('btn-loading loading'); 2195 } 2196 } 2197 } else if ($thisbutton.parents('.product-buttons-item').length) { 2198 2199 var product_id = $thisbutton.siblings("input[name=product_id]").val(); 2200 var data = { 2201 action: 'ohio_ajax_add_to_cart_woo_single', 2202 product_id: product_id, 2203 quantity: 1 2204 }; 2205 } else { 2206 2207 var serializeFormFields = $('form.cart').serializeArray(); 2208 var data = {}; 2209 var prevObj; 2210 2211 $(serializeFormFields).each(function (index, obj) { 2212 2213 if (obj.name == prevObj) { 2214 obj.index = index; 2215 } 2216 2217 prevObj = obj.name 2218 }); 2219 2220 $(serializeFormFields).each(function (index, obj) { 2221 2222 if (obj.index) { 2223 obj.name = obj.name + "-" + obj.index; 2224 } 2225 data[obj.name] = obj.value; 2226 }); 2227 2228 if (data['product_id'] == undefined) { 2229 data['product_id'] = data['add-to-cart']; 2230 } 2231 2232 delete data['add-to-cart']; 2233 2234 data.action = 'ohio_ajax_add_to_cart_woo'; 2235 } 2236 2237 2238 2239 2240 $('body').trigger('adding_to_cart', [$thisbutton, data]); 2241 $.post(wc_cart_fragments_params.ajax_url, data, function (response) { 2242 if (!response) 2243 return; 2244 2245 var this_page = window.location.toString(); 2246 this_page = this_page.replace('add-to-cart', 'added-to-cart'); 2247 if (response.error && response.product_url) { 2248 2249 window.location = response.product_url; 2250 return; 2251 } 2252 2253 if (wc_add_to_cart_params && wc_add_to_cart_params.cart_redirect_after_add == 'yes') { 2254 window.location = wc_add_to_cart_params.cart_url; 2255 return; 2256 } else { 2257 $thisbutton.removeClass('loading'); 2258 var fragments = response.fragments; 2259 var cart_hash = response.cart_hash; 2260 if (fragments) { 2261 $.each(fragments, function (key) { 2262 $(key).addClass('updating'); 2263 }); 2264 } 2265 $('.shop_table.cart, .updating, .cart_totals').fadeTo('400', '0.6').block({ 2266 message: null, 2267 overlayCSS: { 2268 opacity: 0.6 2269 } 2270 }); 2271 $thisbutton.addClass('added'); 2272 $thisbutton.text('Product Added'); 2273 2274 var $classes = ''; 2275 if (($('body').hasClass('single-product') || $thisbutton.parents('.clb-popup').length) && !$thisbutton.hasClass('sticky-product-cart')) { 2276 $classes = ' btn btn-small view-cart'; 2277 } else if ($thisbutton.hasClass('sticky-product-cart')) { 2278 $classes = $classes + ' btn btn-link view-cart'; 2279 } else { 2280 $classes = $classes + ' btn btn-small view-cart'; 2281 } 2282 2283 $thisbutton.after('<a href="' + ohioVariables.cart_page + '" class="' + $classes + '">' + ohioVariables.view_cart + '</a>'); 2284 $thisbutton.css('display', 'none'); 2285 2286 if (fragments) { 2287 $.each(fragments, function (key, value) { 2288 $(key).replaceWith(value); 2289 }); 2290 } 2291 2292 $('.widget_shopping_cart, .updating').stop(true).css('opacity', '1').unblock(); 2293 $('.shop_table.cart').on('load', this_page + ' .shop_table.cart:eq(0) > *', function () { 2294 $('.shop_table.cart').stop(true).css('opacity', '1').unblock(); 2295 $(document.body).trigger('cart_page_refreshed'); 2296 }); 2297 $('.cart_totals').on('load', this_page + ' .cart_totals:eq(0) > *', function () { 2298 $('.cart_totals').stop(true).css('opacity', '1').unblock(); 2299 }); 2300 2301 var productName = ''; 2302 if ($thisbutton.closest('.product').find('h1').length > 0) { 2303 productName = $thisbutton.closest('.product').find('h1').text(); 2304 } else { 2305 productName = $thisbutton.closest('.product').find('.product-item-title').text(); 2306 } 2307 if (productName == '') { 2308 productName = $thisbutton.closest('.clb-popup-product').find('h1').text(); 2309 } 2310 $('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>'); 2311 } 2312 }); 2313 return false;
2314 } else { 2315 return true; 2316 } 2317 }); 2318 }); 2319 2320 /* # Lazy load */ 2321 2322 function lazyLoad(elem) { 2323 if (elem.data('lazy-load-loading')) { 2324 return; 2325 } 2326 2327 // Init 2328 elem.data('isLoaded', false); 2329 elem.data('lazy-load-loading', 'true').addClass('active'); 2330 2331 let currentPage = elem.data('lazy-page') ? parseInt(elem.data('lazy-page')) : 1; 2332 currentPage += 1; 2333 2334 elem.data('lazy-page', currentPage); 2335 2336 // Prepare request data 2337 let requestURL = ''; 2338 let data = false; 2339 2340 if (!elem.data('lazy-load-shortcode')) { 2341 let urlPattern = elem.data('lazy-load-url-pattern'); 2342 if (urlPattern) { 2343 requestURL = urlPattern.replace('{{page}}', currentPage); 2344 } else { 2345 requestURL = 'page/' + currentPage; 2346 } 2347 } else { 2348 data = { 2349 shortcode: elem.data('lazy-load-shortcode'), 2350 paged: currentPage, 2351 action: 'ohio_lazy_load_shortcodes' 2352 }; 2353 requestURL = elem.data('lazy-load-rest'); 2354 } 2355 2356 let scopeSlug = elem.data('lazy-load-scope'); 2357 2358 // Get page content 2359 $.ajax({ 2360 url: requestURL, 2361 data: data, 2362 method: (data) ? 'POST' : 'GET', 2363 success: function (content) { 2364 var dom = $(new DOMParser().parseFromString(content, 'text/html')); 2365 var items = dom.find('[data-lazy-item][data-lazy-scope="' + scopeSlug + '"]'); 2366 2367 var container = elem.parent().find('[data-lazy-container="' + scopeSlug + '"]'); 2368 if (container.length == 0) { 2369 container = $('[data-lazy-container="' + scopeSlug + '"]'); 2370 } 2371 items.parent().find('[data-aos]').attr('data-aos-offset', '20000000'); 2372 items.addClass('hidden'); 2373 2374 container.append(items); 2375 $(document.body).append(dom.find('[data-lazy-to-footer]')); 2376 2377 // Check images is loaded 2378 var metroImages = []; 2379 items.find('[data-ohio-bg-image]').each(function () { 2380 var img = document.createElement('img'); 2381 img.src = $(this).attr('data-ohio-bg-image'); 2382 metroImages.push(img); 2383 }); 2384 var checkImages = function () { 2385 var result = true, result2 = true; 2386 2387 items.find('img').removeAttr('loading').each(function () { 2388 if (!this.complete) { 2389 result = false;
2390 $(this).on('load', checkImages); 2391 return false; 2392 } 2393 }); 2394 2395 if (result) { 2396 for (var i = 0; i < metroImages.length; i++) { 2397 if (!metroImages[i].complete) { 2398 result2 = false; 2399 metroImages[i].onload = checkImages; 2400 return false; 2401 } 2402 } 2403 } 2404 2405 if (result && result2) { 2406 items.removeClass('hidden'); 2407 handlePortfolioPopup(); 2408 handlePortfolio(); 2409 handleQuickviewPopup(items); 2410 2411 var portfolio_data_grid = container.hasClass('portfolio-grid') && container.isotope; 2412 var woo_data_grid = container.attr('data-shop-masonry') && container.isotope; 2413 2414 if (portfolio_data_grid || woo_data_grid) { 2415 container.isotope() 2416 .isotope('appended', items) 2417 .isotope('layout'); 2418 } 2419 2420 if (container.hasClass('ohio-masonry') || container.hasClass('masonry')) { 2421 container.masonry('appended', items, false); 2422 } 2423 2424 items.parent().find('[data-aos]').attr('data-aos-offset', ''); 2425 2426 if (typeof (AOS) != 'undefined') { 2427 // For mobile phones 2428 AOS.init(); 2429 2430 AOS.refresh(); 2431 } 2432 2433 handleOhioBgImages(); 2434 2435 if (currentPage >= parseInt(elem.attr('data-lazy-pages-count'))) { 2436 elem.remove(); 2437 $('body').trigger('ohio:lazy_load_complete'); 2438 $('body').trigger('ohio:cursor_mouseleave'); 2439 } else { 2440 // Wait height animation 2441 elem.removeClass('active'); 2442 if (elem.attr('data-lazy-load') == 'scroll') { 2443 setTimeout(function () { 2444 elem.removeData('lazy-load-loading'); 2445 handleLazyLoadScroll(); 2446 }, 500); 2447 } else { 2448 elem.removeData('lazy-load-loading'); 2449 } 2450 } 2451 } 2452 }; 2453 checkImages(); 2454 2455 handleInteractiveLinksGrid(); 2456 handleMasonry(); 2457 handlePortfolioMovingDetailsGrid(); 2458 setTimeout(function () { 2459 portfolioGridType12(); 2460 }, 100) 2461 2462 2463 elem.data('isLoaded', true); 2464 } 2465 }); 2466 } 2467 2468 function handleLazyLoadScroll() { 2469 $('[data-lazy-load="scroll"]').each(function () { 2470 if ($(document).scrollTop() + $(window).height() > $(this).offset().top) { 2471 lazyLoad($(this)); 2472 } 2473 }); 2474 } 2475 2476 function handleLazyLoadClick() { 2477 $('[data-lazy-load="click"]').on('click', function () { 2478 lazyLoad($(this)); 2479 }); 2480 } 2481 2482 function handleAOS() { 2483 if (typeof (AOS) != 'undefined') { 2484 setTimeout(function () { 2485 AOS.init(); 2486 }, 600); 2487 } 2488 } 2489 2490 function handleStretchContent() { 2491 if (!$('.page-sidebar').length) { 2492 2493 $('[data-vc-stretch-content="true"], [data-vc-full-width="true"], [data-ohio-stretch-content="true"], .alignfull').each(function () { 2494 if (Clb.isRtl) { 2495 $(this).css('right', '0'); 2496 2497 $(this).css({ 2498 'width': $('#page').width() + 'px', 2499 'right': ($('#page').offset().left - $(this).offset().left) + 'px' 2500 }); 2501 } else { 2502 $(this).css('left', '0'); 2503 2504 $(this).css({ 2505 'width': $('#page').width() + 'px', 2506 'left': ($('#page').offset().left - $(this).offset().left) + 'px' 2507 }); 2508 } 2509 2510 setTimeout(function () { 2511 handleAccordionBoxSize(); 2512 }, 10); 2513 2514 }); 2515 2516 $('[data-vc-full-width="true"]').not('[data-vc-stretch-content="true"]').each(function () { 2517 if (!Clb.header || !Clb.header.length) { 2518 return; 2519 } 2520 2521 var padding = ($('#page').outerWidth() - $(this).closest('.page-container').outerWidth()) / 2; 2522 if (!Clb.isMobile) { 2523 padding = padding + 10; 2524 } 2525 2526 if (Clb.header.hasClass('header-6') || Clb.header.hasClass('header-7')) { 2527 if ($(this).parents('.single-product-tabs').length) { 2528 $(this).css({ 2529 'padding-left': padding + 'px', 2530 'padding-right': padding + 90 + 'px', 2531 }); 2532 } 2533 } else { 2534 if ($(this).parents('.single-product-tabs').length) { 2535 $(this).css({ 2536 'padding-left': padding + 'px', 2537 'padding-right': padding + 'px', 2538 }); 2539 } 2540 } 2541 2542 }); 2543 2544 $('.rev_slider_wrapper.fullwidthbanner-container, .rev_slider_wrapper.fullscreen-container').each(function () { 2545 $(this).css('padding-left', $('#page').offset().left + 'px'); 2546 }); 2547 2548 setTimeout(function () { 2549 var revSliders = $('.rev_slider'); 2550 if (revSliders.revredraw) { 2551 revSliders.revredraw(); 2552 } 2553 }, 30); 2554 } 2555 } 2556 2557 window.ohioRowRefresh = handleStretchContent; 2558 2559 function handleScrollEffects() { 2560 $('[data-ohio-scroll-anim]').each(function () { 2561 var anim = $(this).attr('data-ohio-scroll-anim'); 2562 2563 if ($(this).offset().top < ($(window).scrollTop() + $(window).height() - 50)) { 2564 $(this).removeClass(anim).removeAttr('data-ohio-scroll-anim'); 2565 } 2566 }); 2567 } 2568 2569 function handleOhioHeight() { 2570 var windowHeight = $(window).height(); 2571 var footerHeight = $('.site-footer').outerHeight(); 2572 var headerCapHeight = ($('.header-cap').length) ? $('.header-cap').outerHeight() : 0; 2573 var wpAdminHeight = ($('#wpadminbar').length) ? $('#wpadminbar').outerHeight() : 0; 2574 var headerTitleHeight = ($('.clb-page-headline').length) ? $('.clb-page-headline').outerHeight() : 0; 2575 2576 $('[data-ohio-full-height]').each(function () { 2577 var height = windowHeight - footerHeight - headerCapHeight - wpAdminHeight - headerTitleHeight; 2578 2579 $(this).css('height', (height) + 'px'); 2580 }); 2581 } 2582 2583 function handleAlignContentInStretchRow() { 2584 var containerWidth = $('#content').outerWidth(); 2585 var halfContainer = containerWidth / 2 - $('#content .page-container').width() / 2; 2586 2587 // Align content column in wrapper container 2588 var align = function (self, isSplitbox, isParallax, isRight, innerSection) { 2589 if (innerSection) { 2590 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'); 2591 } else { 2592 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'); 2593 } 2594 2595 if (isSplitbox) { 2596 column = self.find('> .split-box-container'); 2597 } 2598 if (isParallax) { 2599 column = self.find('> .parallax-content'); 2600 }
2601 column = (isRight) ? column.last() : column.eq(0); 2602 2603 if (!Clb.isMobile) { 2604 column.css('padding-' + (isRight ? 'right' : 'left'), (halfContainer) + 'px'); 2605 } else { 2606 column.css('padding-' + (isRight ? 'right' : 'left'), ''); 2607 } 2608 }; 2609 2610 // Stretch column 2611 var stretch = function (self, isSplitbox, isRight, innerSection) { 2612 2613 if (innerSection) { 2614 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'); 2615 } else { 2616 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'); 2617 } 2618 column.css('min-width', ''); 2619 2620 column = (isRight) ? column.last() : column.eq(0); 2621 column.css({ 'position': '', 'left': '', 'width': '' }).addClass('stretch-content'); 2622 2623 if (column.length) { 2624 if (isRight) { 2625 column.css('min-width', (containerWidth - column.offset().left) + 'px'); 2626 } else { 2627 column.css({ 2628 'position': 'relative', 2629 'left': -(column.offset().left) + 'px', 2630 'min-width': (column.offset().left + column.outerWidth()) + 'px' 2631 }); 2632 } 2633 if (Clb.isMobile) { 2634 column.css({ 2635 'min-width': '', 2636 'left': '' 2637 }); 2638 } 2639 } 2640 }; 2641 2642 $('.clb-column-padding-left').each(function () { 2643 align($(this), $(this).hasClass('split-box'), $(this).hasClass('parallax'), false, $(this).hasClass('inner')); 2644 }); 2645 2646 $('.clb-column-padding-right').each(function () { 2647 align($(this), $(this).hasClass('split-box'), $(this).hasClass('parallax'), true, $(this).hasClass('inner')); 2648 }); 2649 2650 $('.clb-stretch-column-left').each(function () { 2651 stretch($(this), $(this).hasClass('split-box'), false, $(this).hasClass('inner')); 2652 }); 2653 2654 $('.clb-stretch-column-right').each(function () { 2655 stretch($(this), $(this).hasClass('split-box'), true, $(this).hasClass('inner')); 2656 }); 2657 2658 2659 } 2660 2661 function boxedPageRowWidth() { 2662 var boxedPage = $('.boxed-container'); 2663 2664 if (boxedPage.length) { 2665 var boxedPageWidth = boxedPage.width(); 2666 var boxedContainerOffset = boxedPage.offset().left; 2667 var siteContentWidth = $('.site-content > .page-container').outerWidth(); 2668 var stretchRowPaddings; 2669 var rowOffset; 2670 $('[data-vc-full-width], .elementor-section-stretched').each(function () { 2671 2672 $(this).css({ 2673 'width': boxedPageWidth, 2674 'left': 'auto' 2675 }); 2676 2677 rowOffset = $(this).offset().left; 2678 $(this).css({ 2679 'left': (rowOffset - boxedContainerOffset) * -1 2680 }); 2681 2682 stretchRowPaddings = ($(this).outerWidth() - siteContentWidth) / 2; 2683 2684 if ($(this).hasClass('vc_row') && $(this).data('vc-full-width') && !$(this).data('vc-stretch-content')) { 2685 $(this).css({ 2686 'padding-left': stretchRowPaddings, 2687 'padding-right': stretchRowPaddings, 2688 }); 2689 } 2690 }); 2691 } 2692 } 2693 2694 function instagramFeedCustomCursor() { 2695 var instaFeed = $('#sb_instagram .sbi_item .sbi_photo_wrap'); 2696 2697 instaFeed.each(function () {
2698 $(this).attr('data-cursor-class', 'cursor-link'); 2699 }); 2700 } 2701 2702 function handleMutationObserver() { 2703 var target = $('#sb_instagram #sbi_images, #order_review, .portfolio-grid, [data-lazy-load-scope="projects"]'); 2704 if (target != undefined) { 2705 target.each(function () { 2706 var target = this; 2707 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 2708 var observer = new MutationObserver(function (mutations) { 2709 mutations.forEach(function (mutation) { 2710 if ($(target).attr('id') == 'sbi_images') { 2711 if (mutation.addedNodes.length) { 2712 instagramFeedCustomCursor(); 2713 observer.disconnect(); //Can disconect whole function 'handleMutationObserver' 2714 } 2715 } 2716 2717 if ($(target).attr('id') == 'order_review') { 2718 if (mutation.addedNodes.length) { 2719 btnPreloader(); 2720 observer.disconnect(); //Can disconect whole function 'handleMutationObserver' 2721 } 2722 } 2723 2724 if ($(target).hasClass('lazy-load')) { 2725 2726 if (mutation.oldValue.indexOf('active') != -1) { 2727 if ($(target).data('isLoaded')) { 2728 2729 var portfolioGrid = $(target).parent(); 2730 if (portfolioGrid.find('.portfolio-sorting').length) { 2731 setTimeout(function () { 2732 if (isFilterItemsHidden(portfolioGrid)) { 2733 lazyLoad($('[data-lazy-load]')); 2734 } 2735 }, 1000); 2736 } 2737 } 2738 } 2739 } 2740 }); 2741 }); 2742 2743 2744 // Settings observer 2745 var config = { 2746 attributes: true, 2747 characterData: true, 2748 childList: true, 2749 subtree: true, 2750 attributeOldValue: true, 2751 characterDataOldValue: true, 2752 } 2753 2754 // Start observer 2755 2756 observer.observe(this, config); 2757 2758 }); 2759 } 2760 } 2761 2762 $(document).on('click', '.search_results_btn', function () { 2763 $('.woocommerce-product-search').trigger('submit'); 2764 }); 2765 2766 // Search action to keyup 2767 $('.woocommerce-product-search input[name=s]').on("keyup", function (event) { 2768 if (!$('.woocommerce-product-search .search-submit').hasClass('btn-loading')) { 2769 $('.woocommerce-product-search .search-submit').addClass('btn-loading'); 2770 } 2771 2772 var form = $(this).closest('form'); 2773 var data = { 2774 'action': 'ohio_ajax_search', 2775 'search_query': $(this).val(), 2776 'search_term': $('select[name="search_term"]').val() 2777 }; 2778 2779 $.post(ohioVariables.url, data, function (response) { 2780 $('.search_results').empty(); 2781 $('.woocommerce-product-search .search-submit').removeClass('btn-loading'); 2782 $('.search_results').append(response); 2783 form.attr('action', $('#search_form_action').attr('data-href')); 2784 btnPreloader(); 2785 }); 2786 }); 2787 2788 // Search action to focus 2789 $('.woocommerce-product-search input[name=s]').on("focus", function (event) { 2790 2791 if ($('.search_results').children().length == 0) { 2792 if (!$('.woocommerce-product-search .search-submit').hasClass('btn-loading')) { 2793 $('.woocommerce-product-search .search-submit').addClass('btn-loading'); 2794 } 2795 2796 var form = $(this).closest('form'); 2797 var data = { 2798 'action': 'ohio_ajax_search', 2799 'search_query': $(this).val(), 2800 'search_term': $('select[name="search_term"]').val() 2801 }; 2802 2803 $.post(ohioVariables.url, data, function (response) { 2804 $('.search_results').empty(); 2805 $('.woocommerce-product-search .search-submit').removeClass('btn-loading'); 2806 $('.search_results').append(response); 2807 form.attr('action', $('#search_form_action').attr('data-href')); 2808 btnPreloader(); 2809 }); 2810 } 2811 }); 2812 2813 // Search action to select category
2814 $(document).on('change', '.woocommerce-product-search select', function () { 2815 if (!$('.woocommerce-product-search .search-submit').hasClass('btn-loading')) { 2816 $('.woocommerce-product-search .search-submit').addClass('btn-loading'); 2817 } 2818 2819 var form = $(this).closest('form'); 2820 var data = { 2821 'action': 'ohio_ajax_search', 2822 'search_query': $('input[name=s]').val(), 2823 'search_term': $('select[name="search_term"]').val() 2824 }; 2825 2826 $.post(ohioVariables.url, data, function (response) { 2827 $('.search_results').empty(); 2828 $('.woocommerce-product-search .search-submit').removeClass('btn-loading'); 2829 $('.search_results').append(response); 2830 form.attr('action', $('#search_form_action').attr('data-href')); 2831 }); 2832 }); 2833 2834 //Btn preloader 2835 function btnPreloader() { 2836 var buttons = $('.btn-loading-disabled'); 2837 2838 btnLoading(buttons); 2839 2840 function btnLoading(btn) { 2841 btn.each(function () { 2842 $(this).on('click', function () { 2843 2844 var form = $(this).parents('form'); 2845 var validation = true; 2846 2847 form.find('[required]').each(function() { 2848 if (!$(this).val()) { 2849 validation = false 2850 } 2851 }); 2852 2853 if (!($(this).hasClass('disabled')) && validation) { 2854 $(this).toggleClass('btn-loading'); 2855 $(this).find('i').hide(); 2856 } 2857 }); 2858 }); 2859 } 2860 } 2861 2862 /*Single product*/ 2863 2864 function handleSingleProductGallery(scrollContainer, product) { 2865 2866 if (scrollContainer === undefined) { 2867 var scrollContainer = $('body, html'); 2868 } 2869 2870 if (product === undefined) { 2871 var product = $('.woo_c-product.single-product'); 2872 } 2873 2874 var productImages = product.find('.woo_c-product-image .image-wrap img'); 2875 2876 if (productImages.length > 1 && !product.find('.product-image-dots').length) { 2877 2878 if (!product.parents('.clb-popup-product').length) { 2879 var data = 'data-ohio-content-scroll="#scroll-product"'; 2880 } 2881 2882 var productContainer = product.find('.woo_c-product-image').addClass('with-gallery'); 2883 2884 var imageDots = $('<div class="product-image-dots" ' + data + '></div>'); 2885 2886 imageDots.prependTo(productContainer); 2887 2888 productImages.each(function (i) { 2889 var clonedImg = $(this).clone(); 2890 var dotImage = $('<div class="product-image-dot" ></div>'); 2891 2892 clonedImg.appendTo(dotImage); 2893 dotImage.appendTo(imageDots); 2894 if (i == 0) { 2895 dotImage.addClass('active'); 2896 } 2897 }); 2898 2899 if (!product.parents('.clb-popup').length) { 2900 imageDots.css('height', imageDots.height()); 2901 } 2902 2903 2904 var productOffset = product.offset().top; 2905 var productImageSlider = product.find('.woo_c-product-image-slider'); 2906 2907 productImageSlider.css({ 2908 'width': productImageSlider.outerWidth() 2909 }); 2910 2911 var productImageDots = $('.product-image-dot'); 2912 2913 var imagesOffset = []; 2914 2915 if (product.parents('.clb-popup-product').length) { 2916 var sumHeight = 0; 2917 productImages.each(function () { 2918 var imgHeight = $(this).height(); 2919 imagesOffset.push(sumHeight); 2920 sumHeight += imgHeight; 2921 }); 2922 } else { 2923 productImages.each(function () { 2924 imagesOffset.push($(this).offset().top); 2925 }); 2926 } 2927 2928 //Slider 2929 var iteration = 0; 2930 2931 productImageDots.on('click', function () { 2932 $('.product-image-dot').removeClass('active'); 2933 $(this).addClass('active'); 2934 var index = $('.product-image-dot').index(this); 2935 iteration = index; 2936 var curentImage = $(productImages[index]); 2937 scrollContainer.animate({ 2938 scrollTop: imagesOffset[iteration] 2939 }, 500) 2940 }); 2941 2942 scrollContainer.on('scroll wheel', function (e) { 2943 var y = e.originalEvent.deltaY; 2944 2945 if (($(this).scrollTop() >= imagesOffset[iteration]) && y > 0) { 2946 productImageDots.removeClass('active'); 2947 $(productImageDots[iteration]).addClass('active'); 2948 iteration++; 2949 } 2950 else if (y < 0 && ($(this).scrollTop() >= imagesOffset[iteration - 1] && $(this).scrollTop() < imagesOffset[iteration])) { 2951 iteration--; 2952 productImageDots.removeClass('active'); 2953 $(productImageDots[iteration]).addClass('active'); 2954 } 2955 2956 if (iteration > productImages.length - 1 && y < 0) { 2957 iteration--; 2958 } 2959 }); 2960 } 2961 var singleProductGallery = $('.woocommerce-product-gallery'); 2962 2963 if (Clb.isPad) { 2964 singleProductGallery.clbSlider({ 2965 dots: false, 2966 drag: true, 2967 navBtn: true 2968 }); 2969 } else { 2970 setTimeout(function () { 2971 singleProductGallery.clbSlider('destroy'); 2972 }, 400); 2973 } 2974 } 2975 2976 //Sticky product 2977 2978 function handleStickyProduct() { 2979 var productImg = $('.woo_c-product-image'); 2980 var stickyProduct = $('.sticky-product'); 2981 var stickyProductImg = stickyProduct.find('.sticky-product-img'); 2982 var stickyProductNav = $('.sticky-nav-product'); 2983 2984 $(window).scroll(function () { 2985 if ($(window).scrollTop() > productImg.height()) { 2986 stickyProduct.addClass('visible'); 2987 stickyProductNav.addClass('invisible'); 2988 } else { 2989 stickyProduct.removeClass('visible'); 2990 stickyProductNav.removeClass('invisible'); 2991 } 2992 }); 2993 2994 if (Clb.isMobile) { 2995 var contentWidth = $('#content').height(); 2996 var contentOffset = $('#content').offset().top; 2997 var contentEnd = contentWidth + contentOffset - $(window).height(); 2998 2999 $(window).scroll(function () { 3000 if ($(window).scrollTop() > contentEnd) { 3001 stickyProduct.removeClass('visible'); 3002 } 3003 }); 3004 } 3005 3006 stickyProductImg.on("click", function () { 3007 $('body, html').animate({ scrollTop: 0 }, 500); 3008 }); 3009 3010 stickyProduct.find('.clb-close').on('click', function () { 3011 stickyProduct.removeClass('visible'); 3012 setTimeout(function () { 3013 stickyProduct.css('display', 'none'); 3014 }, 300); 3015 }); 3016 } 3017 /*language dropdown*/ 3018 3019 //*Hide empty language container* 3020 $(function () { 3021 var language = $('.header-wrap .right .languages'); 3022 3023 if (language.find('.sub-nav.languages').children().length == 0) { 3024 language.hide(); 3025 } 3026 }); 3027 3028 function centeredLogo() { 3029 /*header-4 centered logo*/ 3030 var header = $('.header-4'); 3031 var headerNav = header.find('.nav'); 3032 3033 //Menu-others have to be equal width 3034 header.find('.left-part, .right-part').css('width', menuOtherEqualWidth(header)); 3035 3036 var siteBrand = $('.branding'); 3037 var navMenu = $('#mega-menu-wrap').find('> ul:not(.mobile-menu) > li'); 3038 var logoWidth = siteBrand.outerWidth() - ($(window).width() * 0.0135); 3039 var centerLi = findCenterLi(navMenu); 3040 var firstMenuItemsWidth = 0; 3041 var menuLinkPadding = $(navMenu[centerLi]).find('> .menu-link').css('padding-left'); 3042 3043 navMenu.each(function (i) { 3044 if (i > centerLi) { 3045 return; 3046 } 3047 3048 firstMenuItemsWidth += $(this).width(); 3049 }); 3050 3051 headerNav.offset({ left: siteBrand.offset().left - firstMenuItemsWidth + (parseInt(menuLinkPadding) / 2) }); 3052 3053 $(navMenu[centerLi]).css('margin-right', logoWidth + "px"); 3054 3055 wideMenuOnResizePosition(); 3056 3057 setTimeout(function () { 3058 header.css('opacity', '1'); 3059 }, 500); 3060 3061 } 3062 3063 //Find center Li element 3064 function findCenterLi(menu) { 3065 if (menu.length % 2 == 0) { 3066 return Math.round((menu.length / 2) - 1); 3067 } 3068 else { 3069 return Math.round((menu.length / 2) - 2); 3070 } 3071 } 3072 3073 //Menu other equal width 3074 function menuOtherEqualWidth(header) { 3075 var menuOther = header.find('.left-part, .right-part'); 3076 var menuOtherWidth = 0; 3077 3078 menuOther.each(function () { 3079 if (menuOtherWidth < $(this).width()) { 3080 menuOtherWidth = $(this).width(); 3081 } 3082 }); 3083 3084 return menuOtherWidth + 1; 3085 } 3086 3087 /*Header 6*/ 3088 3089 $.each($('header.header-5'), function () {
3090 $(".menu-depth-1").removeClass('sub-menu-wide'); 3091 }); 3092 3093 /*Curency switcher*/ 3094 $('.currency_switcher').css('opacity', '1'); 3095 3096 /*Products grid*/ 3097 function handleProductsGridGallery() { 3098 var productSlider = $('.product-item-grid .slider'); 3099 3100 productSlider.each(function () { 3101 var slider = $(this); 3102 3103 if (Clb.isElementorPage) { 3104 slider.width(slider.width()); 3105 } 3106 3107 if (slider.find('img').length > 1) { 3108 slider.clbSlider({ 3109 dots: false, 3110 loop: true, 3111 //verticalScroll: true, 3112 navBtnClasses: 'btn-round-light btn-round-small' 3113 }); 3114 } 3115 }); 3116 3117 setTimeout(function () { 3118 handleShopMasonry(); 3119 }, 1000); 3120 } 3121 3122 // Logo overlay style 3123 3124 function logoOverlay() { 3125 var logoItems = $('.client-logo .client-logo-overlay'); 3126 3127 logoItems.each(function () { 3128 var logoDetails = $(this).find('.client-logo-details'); 3129 var logoDetailWidth = logoDetails.outerHeight(); 3130 3131 logoDetails.css({ 3132 'height': logoDetailWidth, 3133 'bottom': '-' + logoDetailWidth + 'px', 3134 }) 3135 }); 3136 } 3137 3138 // Product grid filter 3139 function handleMobileFilter() { 3140 var btn = $('.btn-filter a.btn'); 3141 var filter = $('.filter-holder .mbl-overlay'); 3142 var close = $('.clb-close, .mbl-overlay-bg'); 3143 3144 btn.on('click', function () { 3145 event.preventDefault(); 3146 handlePopup('.filter-holder .mbl-overlay'); 3147 }); 3148 close.on('click', function () { 3149 closePopup(filter) 3150 }); 3151 3152 $(document).on('keydown', function (e) { 3153 if (e.keyCode == 27) { 3154 closePopup(filter); 3155 } 3156 }); 3157 } 3158 3159 // Subscribe popup 3160 3161 function SubscribeModal() { 3162 3163 var data = { 3164 action: 'ohio_subscribe_modal' 3165 }; 3166 3167 jQuery.post(ohioVariables.url, data, function (data) { 3168 handlePopup('.clb-popup.custom-popup:not(.clb-gallery-lightbox)'); 3169 var popupInner = $('.custom-popup .clb-popup-holder'); 3170 popupInner.append(data); 3171 3172 var wpcf7_form = $('.wpcf7-form'); 3173 [].forEach.call(wpcf7_form, function (form) { 3174 wpcf7.init(form); 3175 handleSubscribeContactForm(); 3176 }); 3177 }); 3178 } 3179 3180 function handleSubscribeModal() { 3181 switch (ohioVariables.subscribe_popup_type) { 3182 case 'time': 3183 setTimeout(function () { 3184 SubscribeModal(); 3185 }, +ohioVariables.subscribe_popup_var * 1000); 3186 break; 3187 case 'scroll': 3188 var ckeck = true; 3189 $(window).on('scroll', function (e) { 3190 var scrollTop = $(window).scrollTop(); 3191 var docHeight = $(document).height(); 3192 var winHeight = $(window).height(); 3193 var scrollPercent = (scrollTop) / (docHeight - winHeight); 3194 var scrollPercentRounded = Math.round(scrollPercent * 100); 3195 if (ckeck && scrollPercentRounded > ohioVariables.subscribe_popup_var) { 3196 SubscribeModal(); 3197 ckeck = false; 3198 } 3199 }); 3200 break; 3201 case 'exit': 3202 var ckeck = true; 3203 $(document).on('mouseleave', function () { 3204 if (ckeck) { 3205 SubscribeModal(); 3206 ckeck = false; 3207 } 3208 }); 3209 break; 3210 } 3211 } 3212 3213 $('[href=\\#subscribe-init]').on('click', function (e) { 3214 e.preventDefault(); 3215 handlePopup('.clb-popup.custom-popup'); 3216 SubscribeModal(); 3217 }); 3218 3219 if (ohioVariables.subscribe_popup_enable && !getCookie('subscribeCookie')) { 3220 handleSubscribeModal(); 3221 } 3222 3223 3224 //Portfolio 3225 function handlePortfolioOnepageSlider() {
3226 var slider = $('[data-portfolio-grid-slider]'); 3227 var portfolio = $('.portfolio-item-fullscreen'); 3228 3229 var loopSetting = Boolean(slider.attr('data-slider-loop')), 3230 navSetting = Boolean(slider.attr('data-slider-navigation')), 3231 bulletsSetting = Boolean(slider.attr('data-slider-dots')), 3232 paginationSetting = Boolean(slider.attr('data-slider-pagination')), 3233 mousescrollSetting = Boolean(slider.attr('data-slider-mousescroll')), 3234 dragScrollSetting = Boolean(slider.attr('data-slider-dragcroll')), 3235 autoplaySetting = Boolean(slider.attr('data-slider-autoplay')), 3236 autoplayPauseSetting = Boolean(slider.attr('data-slider-autoplay-pause')), 3237 autoplayTimeSetting = slider.attr('data-slider-autoplay-time'); 3238 3239 slider.each(function () { 3240 var slider = $(this); 3241 3242 var sliderOffset = slider.offset().top; 3243 var sliderHeight = slider.height(); 3244 3245 if (slider.hasClass('grid_3') || slider.hasClass('grid_7') || slider.hasClass('project-fullscreen-slider')) { 3246 3247 slider.clbSlider({ 3248 items: 1, 3249 loop: loopSetting, 3250 mousewheel: mousescrollSetting, 3251 navBtn: navSetting, 3252 drag: dragScrollSetting, 3253 dots: bulletsSetting, 3254 pagination: paginationSetting, 3255 scrollToSlider: true, 3256 autoplay: autoplaySetting, 3257 autoplayTimeout: autoplayTimeSetting, 3258 autoplayHoverPause: true 3259 }); 3260 3261 fadeoutSliderItemAnimation(slider); 3262 removePerspectiveWhileScrolling(slider); 3263 } else if (slider.hasClass('grid_4')) { 3264 slider.clbSlider({ 3265 items: 1, 3266 loop: loopSetting, 3267 mousewheel: mousescrollSetting, 3268 navBtn: navSetting, 3269 drag: true, 3270 dots: false, 3271 pagination: paginationSetting, 3272 scrollToSlider: true, 3273 verticalScroll: true, 3274 autoplay: autoplaySetting, 3275 autoplayTimeout: autoplayTimeSetting, 3276 autoplayHoverPause: true 3277 }); 3278 3279 fadeoutSliderItemAnimation(slider); 3280 removePerspectiveWhileScrolling(slider); 3281 } else if (slider.hasClass('grid_6')) { 3282 const columns = slider.attr('data-slider-columns').split('-'); 3283 3284 slider.clbSlider({ 3285 items: +columns[0] || 3, 3286 loop: loopSetting, 3287 mousewheel: mousescrollSetting, 3288 navBtn: navSetting, 3289 drag: true, 3290 dots: false, 3291 pagination: paginationSetting, 3292 scrollToSlider: true, 3293 autoplay: autoplaySetting, 3294 autoplayTimeout: autoplayTimeSetting, 3295 autoplayHoverPause: true, 3296 responsive: { 3297 768: { 3298 items: +columns[2] || 1, 3299 }, 3300 1024: { 3301 items: +columns[1] || 2 3302 } 3303 } 3304 }); 3305 3306 fadeoutSliderItemAnimation(slider); 3307 removePerspectiveWhileScrolling(slider); 3308 } else if (slider.hasClass('grid_5') || slider.hasClass('grid_9') || slider.hasClass('grid_10')) { 3309 handleSmoothSlider(); 3310 } 3311 3312 if (slider.hasClass('grid_9')) { 3313 var nextProjectImg = $('.next-project-img-box'); 3314 3315 nextProjectImg.on('click', function () { 3316 $(this).trigger('prev-slide'); 3317 }); 3318 3319 $('.clb-scroll-top:not(.clb-slider-scroll-top)').hide(); 3320 } 3321 3322 if ($(window).scrollTop() > (sliderOffset + (sliderHeight / 2)) || $(window).scrollTop() < sliderOffset - (sliderHeight / 2)) { 3323 toggleSliderScrollBar('hide-all'); 3324 } 3325 3326 $(window).on('scroll', function () { 3327 if ($(window).scrollTop() >
3327 (sliderOffset + (sliderHeight / 2)) || $(window).scrollTop() < sliderOffset - (sliderHeight / 2)) { 3328 toggleSliderScrollBar('hide'); 3329 } else { 3330 toggleSliderScrollBar('show'); 3331 } 3332 }); 3333 3334 //Portfolio grid 3 overlay height 3335 if (!Clb.isMobile && (portfolio.hasClass('portfolio-grid-type-3') || portfolio.hasClass('portfolio-grid-type-6'))) { 3336 calcHeightForOnepageItemsOverlay(slider); 3337 } 3338 }); 3339 } 3340 $(window).on('ohio:handle_portfolio_onepage_slider', handlePortfolioOnepageSlider); 3341 3342 /*Onepage slider help functions*/ 3343 function calcHeightForOnepageItemsOverlay(slider) { 3344 3345 if (slider === undefined) { 3346 var slider = $('[data-portfolio-grid-slider]'); 3347 } 3348 3349 var overlay = slider.find('.portfolio-item-overlay'); 3350 var overlayHeight = 0; 3351 var height = 0; 3352 3353 overlay.each(function () { 3354 height = $(this).height() 3355 if (overlayHeight < height) { 3356 overlayHeight = height; 3357 } 3358 }); 3359 if (!Clb.isMobile) { 3360 overlay.css('height', overlayHeight); 3361 } else { 3362 overlay.removeAttr('style'); 3363 } 3364 } 3365 3366 function removePerspectiveWhileScrolling(slider) { 3367 slider.on('clb-slider.change', function () { 3368 $(this).addClass('perspective-remove'); 3369 }); 3370 setTimeout(function () { 3371 slider.on('clb-slider.changed', function () { 3372 $(this).removeClass('perspective-remove'); 3373 }); 3374 }, 500); 3375 } 3376 3377 function fadeoutSliderItemAnimation(slider) { 3378 slider.on('clb-slider.next-change', function () { 3379 3380 var activeItems = slider.find('.clb-slider-item.active'); 3381 activeItems.eq(0).addClass('last-active'); 3382 3383 setTimeout(function () { 3384 activeItems.eq(0).removeClass('last-active'); 3385 }, 1000); 3386 3387 }).on('clb-slider.prev-change', function () { 3388 3389 var activeItems = slider.find('.clb-slider-item.active'); 3390 activeItems.eq(activeItems.length - 1).addClass('last-active'); 3391 3392 setTimeout(function () { 3393 activeItems.eq(activeItems.length - 1).removeClass('last-active'); 3394 }, 1000); 3395 3396 }); 3397 } 3398 3399 /* End onepage slider help functions*/ 3400 3401 function handleSmoothSlider(onePage) { 3402 //Init 3403 if (onePage === undefined) { 3404 var onePage = $('.portfolio-onepage-slider'); 3405 } 3406 3407 onePage.addClass('clb-smooth-slider'); 3408 3409 var currentItem = 0; 3410 var onePageItems = onePage.children().addClass('clb-smooth-slider-item'); 3411 var onePageItemsCount = onePageItems.length; 3412 3413 //Settings 3414 var loopSetting = Boolean(onePage.attr('data-slider-loop')), 3415 navSetting = Boolean(onePage.attr('data-slider-navigation')), 3416 bulletsSetting = Boolean(onePage.attr('data-slider-dots')), 3417 paginationSetting = Boolean(onePage.attr('data-slider-pagination')), 3418 mousescrollSetting = Boolean(onePage.attr('data-slider-mousescroll')), 3419 autoplaySetting = Boolean(onePage.attr('data-slider-autoplay')), 3420 autoplayTimeSetting = onePage.attr('data-slider-autoplay-time'); 3421 3422 onePage.css({ 3423 'height': onePageItems.height() 3424 }); 3425 3426 $(window).on('resize', function () { 3427 onePage.css({ 3428 'height': onePageItems.height() 3429 }); 3430 }); 3431 3432 onePageItems.css({ 3433 'position': 'absolute', 3434 }); 3435 3436 /*Events*/ 3437 onePage.on('next-slide', function (e) { 3438 nextSlide(); 3439 }); 3440 3441 onePage.on('prev-slide', function (e) { 3442 prevSlide(); 3443 }); 3444 3445 /*Create elements*/ 3446 3447 //Nav btn 3448 if (navSetting === true) { 3449 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
3449ox="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>'; 3450 onePage.append($(createNavBtn)); 3451 } 3452 //Pagination 3453 if (paginationSetting === true || bulletsSetting === true) { 3454 var createPagination = $('<div></div>'); 3455 var page = $('<div class="clb-slider-page"></div>'); 3456 3457 if (paginationSetting === true) { 3458 createPagination.addClass('clb-slider-pagination'); 3459 for (var i = 1; i <= onePageItemsCount; i++) { 3460 if (i < 10) { 3461 page.clone().append('<span class="clb-slider-pagination-index"> 0' + i + '</span>').appendTo(createPagination); 3462 } else { 3463 page.clone().append('<span class="clb-slider-pagination-index">' + i + '</span>').appendTo(createPagination); 3464 } 3465 } 3466 } else { 3467 createPagination.addClass('clb-slider-nav-dots'); 3468 page.addClass('clb-slider-dot'); 3469 for (var i = 1; i <= onePageItemsCount; i++) { 3470 page.clone().appendTo(createPagination); 3471 } 3472 } 3473 3474 createPagination.find('.clb-slider-page:first-child').addClass('active'); 3475 onePage.append(createPagination); 3476 3477 $(onePageItems).removeClass('prev-slide next-slide active'); 3478 $(onePageItems.slice(0, currentItem)).addClass('prev-slide'); 3479 $(onePageItems.slice(currentItem + 1)).addClass('next-slide'); 3480 $(onePageItems[currentItem]).addClass('active'); 3481 3482 //pagination 3483 var paginationNumbers = onePage.find('.clb-slider-page'); 3484 var navBtnId = 0; 3485 paginationNumbers.on('click', function () { 3486 paginationNumbers.removeClass('active'); 3487 $(this).addClass('active'); 3488 navBtnId = $(this).index(); 3489 3490 //navBtnId + 1 because navBtnId start from 0 and slideNow start from 1 3491 if (navBtnId != currentItem) { 3492 if (navBtnId + 1 > onePageItemsCount) { 3493 navBtnId = navBtnId - settings.items + 1; 3494 } 3495 3496 var lastSlide = currentItem 3497 currentItem = navBtnId; 3498 toSlide(lastSlide); 3499 } 3500 }); 3501 3502 } else { 3503 $(onePageItems[currentItem]).addClass('active'); 3504 $(onePageItems[onePageItemsCount - 1]).addClass('prev-slide'); 3505 $(onePageItems[currentItem + 1]).addClass('next-slide'); 3506 } 3507 3508 /*Script work place*/ 3509 3510 //Nav btn 3511 onePage.find('.next-btn').on('click', function () { 3512 nextSlide(); 3513 }); 3514 3515 onePage.find('.prev-btn').on('click', function () { 3516 prevSlide(); 3517 }); 3518 3519 //Key controll 3520 $(window).on('keydown', function (e) { 3521 var key = e.which || e.keyCode; 3522 3523 if (key == 37) { 3524 prevSlide(); 3525 } 3526 if (key == 39) { 3527 nextSlide(); 3528 } 3529 }); 3530 3531 //Mouse scroll 3532 if (mousescrollSetting === true) { 3533 if (navigator.userAgent.indexOf('Mac OS X') != -1) { 3534 var timeoutDelay = 1300; 3535 } else { 3536 var timeoutDelay = 1000; 3537 } 3538 var wheel = true; 3539 var top = onePage.offset().top - ($(window).height() - onePage.outerHeight()) / 2; 3540 onePage.on('wheel mousewheel', function (e) { 3541 3542 var y = e.originalEvent.deltaY; 3543 if ((currentItem == 0 && y > 0) || (currentItem == onePageItemsCount && y < 0)) { 3544 $("html, body").animate({ scrollTop: onePage.offset().top + 'px' }); 3545 e.preventDefault(); 3546 } 3547 3548 if (wheel) { 3549 if (y > 0 && currentItem <= onePageItemsCount - 1) { 3550 3551 nextSlide(); 3552 wheel = false;
3553 3554 if (loopSetting) { 3555 e.preventDefault(); 3556 } else { 3557 if (!(currentItem == onePageItemsCount)) { 3558 e.preventDefault(); 3559 } else { 3560 $('html, body').stop(true, true).finish(); 3561 } 3562 } 3563 } else if (y < 0 && currentItem >= 0) { 3564 3565 if (loopSetting) { 3566 e.preventDefault(); 3567 } else { 3568 if (!(currentItem == 0)) { 3569 e.preventDefault(); 3570 } else { 3571 $('html, body').stop(true, true).finish(); 3572 } 3573 } 3574 prevSlide(); 3575 wheel = false; 3576 } 3577 } else { 3578 return false; 3579 } 3580 3581 setTimeout(function () { 3582 wheel = true; 3583 }, timeoutDelay); 3584 }); 3585 } 3586 3587 //Touch events 3588 3589 onePage.on('touchstart', function (e) { 3590 3591 var cursorPosition = e.originalEvent.touches[0].pageX; 3592 3593 onePage.on('touchmove', function (e) { 3594 3595 var position = e.originalEvent.touches[0].pageX; 3596 3597 if (position + 50 < cursorPosition) { 3598 nextSlide(); 3599 cursorPosition = e.clientX; 3600 } else if (position - 50 > cursorPosition) { 3601 prevSlide(); 3602 cursorPosition = e.clientX; 3603 } 3604 }) 3605 3606 3607 onePage[0].ondragstart = function () { 3608 return false; 3609 }; 3610 }); 3611 3612 //Autoplay 3613 if (autoplaySetting === true) { 3614 var autoSlideInterval = setInterval(function () { 3615 if (!onePage.hasClass('stop-slide')) { 3616 nextSlide(); 3617 } 3618 }, autoplayTimeSetting); 3619 3620 onePage.hover(function () { 3621 $(this).addClass('stop-slide'); 3622 }, function () { 3623 $(this).removeClass('stop-slide'); 3624 }); 3625 } 3626 3627 //ScrollBar 3628 function portfolioScrollBar() { 3629 if (onePage.hasClass('portfolio-onepage-slider')) { 3630 let percentage = (100 / onePageItemsCount) * (currentItem + 1); 3631 3632 if (percentage > 100) percentage = 100; 3633 3634 $('.scroll-track').css('width', percentage + '%'); 3635 } 3636 } 3637 3638 function nextSlide() { 3639 3640 if (loopSetting) { 3641 if (currentItem + 1 == onePageItemsCount) { 3642 currentItem = 0; 3643 $(onePageItems).removeClass('active prev-slide last-slide'); 3644 $(onePageItems[onePageItemsCount - 1]).addClass('prev-slide last-slide'); 3645 } else if (currentItem + 2 == onePageItemsCount) { 3646 $(onePageItems[0]).addClass('next-slide'); 3647 currentItem++; 3648 } else if (currentItem == 0) { 3649 $(onePageItems[onePageItemsCount - 1]).removeClass('prev-slide'); 3650 currentItem++; 3651 } else { 3652 currentItem++; 3653 } 3654 } else { 3655 currentItem++; 3656 } 3657 3658 if (paginationSetting) { 3659 paginationNumbers.removeClass('active'); 3660 $(paginationNumbers[currentItem]).addClass('active'); 3661 } 3662 3663 if (!(currentItem == onePageItemsCount)) { 3664 $(onePageItems[currentItem - 1]).addClass('last-slide').removeClass('active'); //prev slide 3665 $(onePageItems[currentItem - 2]).removeClass('prev-slide'); //other sldies 3666 $(onePageItems[currentItem]).removeClass('next-slide').addClass('active'); //active slide 3667 3668 $(onePageItems[currentItem - 1]).addClass('prev-slide'); //prev slide 3669 $(onePageItems[currentItem + 1]).addClass('next-sl
3669ide'); //next slide 3670 setTimeout(function () { 3671 $(onePageItems).removeClass('last-slide'); 3672 }, 800); 3673 3674 } 3675 3676 portfolioScrollBar(); 3677 } 3678 3679 function prevSlide() { 3680 if (loopSetting) { 3681 if (currentItem <= 0) { 3682 currentItem = onePageItemsCount - 1; 3683 $(onePageItems).removeClass('active next-slide last-slide'); 3684 $(onePageItems[0]).addClass('next-slide last-slide'); 3685 } else if (currentItem == 1) { 3686 $(onePageItems[onePageItemsCount - 1]).addClass('prev-slide'); 3687 currentItem--; 3688 } else if (currentItem == onePageItemsCount - 1) { 3689 $(onePageItems[0]).removeClass('next-slide'); 3690 currentItem--; 3691 } else { 3692 currentItem--; 3693 } 3694 } else { 3695 if (!(currentItem == 0)) { 3696 currentItem--; 3697 } 3698 } 3699 3700 if (paginationSetting) { 3701 paginationNumbers.removeClass('active'); 3702 $(paginationNumbers[currentItem]).addClass('active'); 3703 } 3704 3705 if (!(currentItem < 0)) { 3706 $(onePageItems[currentItem]).addClass('active').removeClass('prev-slide'); //active slide 3707 $(onePageItems[currentItem + 1]).removeClass('active').addClass('last-slide'); //next slide 3708 $(onePageItems[currentItem + 2]).removeClass('next-slide').removeClass('last-slide'); //prev slide 3709 3710 $(onePageItems[currentItem - 1]).addClass('prev-slide'); //prev-slide 3711 $(onePageItems[currentItem + 1]).addClass('next-slide'); //next-slide 3712 3713 setTimeout(function () { 3714 $(onePageItems).removeClass('last-slide'); 3715 }, 800); 3716 } 3717 3718 portfolioScrollBar() 3719 } 3720 3721 function toSlide(lastSlide) { 3722 $(onePageItems[lastSlide]).addClass('last-slide'); 3723 $(onePageItems).removeClass('prev-slide next-slide active'); 3724 3725 $(onePageItems.slice(0, currentItem)).addClass('prev-slide'); 3726 3727 $(onePageItems.slice(currentItem)).addClass('next-slide'); 3728 3729 $(onePageItems[currentItem]).addClass('active'); 3730 $(onePageItems[currentItem - 1]).addClass('prev-slide'); //prev slide 3731 $(onePageItems[currentItem + 1]).addClass('next-slide'); //next slide 3732 3733 setTimeout(function () { 3734 $(onePageItems).removeClass('last-slide'); 3735 }, 800); 3736 3737 portfolioScrollBar(); 3738 } 3739 3740 portfolioScrollBar(); 3741 } 3742 3743 // Background image parallax effect 3744 function handleBgParallaxEffect() { 3745 var tiltContainer = $('[data-tilt-effect]'); 3746 3747 var userAgent = navigator.userAgent.toLowerCase(); 3748 var isSafari = false 3749 3750 if (userAgent.indexOf('safari') != -1) { 3751 if (userAgent.indexOf('chrome') > -1) { 3752 isSafari = false; // Chrome 3753 } else { 3754 isSafari = true; // Safari 3755 } 3756 } 3757 3758 tiltContainer.each(function () { 3759 var isTiltEnable = Boolean($(this).attr('data-tilt-effect')); 3760 3761 if (isTiltEnable) { 3762 if (isSafari == false) { 3763 var container = $(this)[0].querySelectorAll(".parallax-holder"); 3764 3765 $(container).each(function (i) { 3766 var inner = $(this).find(".parallax")[0]; 3767 let container = $(this)[0]; 3768 var mouse = { 3769 _x: 0, 3770 _y: 0, 3771 x: 0, 3772 y: 0, 3773 item: '', 3774 updatePosition: function (event) { 3775 var e = event || window.event; 3776 if (isSliderItem($(container))) { 3777 this.x = e.pageX - (Math.floor($(container).width() / 2) + $(container).offset().left); 3778 this.y = (e.pageY - (Math.floor($(container).height() / 2) + $(container).offset().top)) * -1; 3779 } else { 3780 this.x = e.pageX - this._x; 3781 this.y = (e.pageY - this._y) * -1; 3782 } 3783 3784 }, 3785 setOrigin: function (e) { 3786 this._x = Math.floor($(e).width() / 2) + $(container).offset().left; 3787 this._y = Math.floor($(e).height() / 2) + $(container).offset().top; 3788 }, 3789 show: function () { 3790 return "(" + this.x + ", " + this.y + ")"; 3791 } 3792 }; 3793 3794 // Track the mouse position relative to the center of the container. 3795 mouse.setOrigin(container); 3796 3797 var counter = 0; 3798 var refreshRate = 10; 3799 var isTimeToUpdate = function () { 3800 return counter++ % refreshRate === 0; 3801 }; 3802 3803 var onMouseEnterHandler = function (event) { 3804 update(event); 3805 }; 3806 3807 var onMouseLeaveHandler = function () { 3808 // inner.style = ""; 3809 inner.style.transform = ""; 3810 inner.style.webkitTransform = ""; 3811 inner.style.mozTranform = ""; 3812 inner.style.msTransform = ""; 3813 inner.style.oTransform = ""; 3814 }; 3815 3816 var onMouseMoveHandler = function (event) { 3817 if (isTimeToUpdate()) { 3818 update(event); 3819 } 3820 }; 3821 3822 var update = function (event) { 3823 mouse.updatePosition(event); 3824 updateTransformStyle( 3825 (mouse.y / inner.offsetHeight / 2).toFixed(2), 3826 (mouse.x / inner.offsetWidth / 2).toFixed(2) 3827 ); 3828 }; 3829 3830 var updateTransformStyle = function (x, y) { 3831 var style = "rotateX(" + x + "deg) rotateY(" + y + "deg)"; 3832 inner.style.transform = style; 3833 inner.style.webkitTransform = style; 3834 inner.style.mozTranform = style; 3835 inner.style.msTransform = style; 3836 inner.style.oTransform = style; 3837 }; 3838 3839 container.onmousemove = onMouseMoveHandler; 3840 container.onmouseleave = onMouseLeaveHandler; 3841 container.onmouseenter = onMouseEnterHandler; 3842 3843 function isSliderItem(item) { 3844 if (item.hasClass('clb-slider-item') || item.parents('.clb-slider-item').length) { 3845 return true; 3846 } 3847 } 3848 }); 3849 } 3850 } 3851 }); 3852 } 3853 3854 function handleCircleProgressBar() { 3855 3856 var circleProgressBar = $('.circle-progress-bar'); 3857 circleProgressBar.each(function (i) { 3858 var _this = $(this); 3859 3860 var progressValue = $(this).find('.progress__value')[0]; 3861 var value = $(_this).data('percent-value'); 3862 3863 const radius = progressValue.r.animVal.value; 3864 const circumference = 2 * Math.PI * radius; 3865 3866 function progress(value) { 3867 var progress = value / 100; 3868 var dashoffset = circumference * (1 - progress); 3869 progressValue.style.strokeDashoffset = dashoffset; 3870 } 3871 3872 progressValue.style.strokeDasharray = circumference; 3873 if (value < 0) value = 0; 3874 if (value > 100) value = 100; 3875 progress(value); 3876 3877 var counters = _this.find(".percent-wrap .percent")[0]; 3878 var counter = parseInt(counters.innerHTML); 3879 3880 var count = function (start, value, i) { 3881 var localStart = start; 3882 3883 setInterval(function () { 3884 if (localStart < value) { 3885 localStart++; 3886 counters.innerHTML = localStart; 3887 } 3888 }, 1000 / value); 3889 } 3890 3891 count(0, value, i); 3892 3893 }); 3894 } 3895 $(window).on('ohio:handle_circle_progress_bar', handleCircleProgressBar); 3896 3897 function handleScrollMeter() { 3898 const bHeight = $('body').height(); 3899 const scrolled = $(window).innerHeight() + $(window).scrollTop(); 3900 3901 let percentage = ((scrolled / bHeight) * 100); 3902 3903 if (percentage > 100) percentage = 100; 3904 3905 $('.clb-scroll-top:not(.clb-slider-scroll-top) .scroll-track').css('width', percentage + '%'); 3906 } 3907 3908 function handleTeamMemberInner() { 3909 var teamMember = $('.team-member.inner'); 3910 3911 teamMember.each(function () { 3912 var self = $(this); 3913 var teamMemberWrap = self.find('.team-member_wrap'); 3914 var teamMemberDescWrap = self.find('.team-member_description_wrap'); 3915 var teamMemberImage = self.find('.team-member_image'); 3916 3917 teamMemberDescWrap.show(); 3918 3919 teamMemberWrap.css({ 3920 'transform': 'translateY(' + teamMemberDescWrap.outerHeight() + 'px)' 3921 }); 3922 3923 teamMemberImage.hover(function () { 3924 teamMemberWrap.css({ 3925 'transform': 'none' 3926 }); 3927 }, function () { 3928 teamMemberWrap.css({ 3929 'transform': 'translateY(' + teamMemberDescWrap.outerHeight() + 'px)' 3930 }); 3931 }) 3932 3933 }); 3934 } 3935 3936 function handleHorizontalAccordion() { 3937 var accordion = $('.horizontal_accordion'); 3938 3939 accordion.each(function () { 3940 var selfAccordion = $(this); 3941 var items = selfAccordion.find('.horizontal_accordionItem'); 3942 var percent = Clb.isMobile ? 90 : 100 - (100 / (items.length - 1)); 3943 var i = items.length, 3944 z = 1, 3945 t = items.length - 1; 3946 var currentItem; 3947 var currentItemIndex; 3948 3949 if (Clb.isMobile) { 3950 items.removeAttr('style'); 3951 } else { 3952 items.eq(0).addClass('active'); 3953 3954 //z-index for each items by descending 3955 for (; i > 0; i--) { 3956 items.eq(i - 1).css({ 3957 'z-index': z 3958 }); 3959 3960 if (i > 1) { 3961 items.eq(i - 1).css({ 3962 'transform': 'translateX(-' + percent * t + '%)' 3963 }); 3964 t--; 3965 } 3966 z++; 3967 } 3968 3969 items.on('click', function (i) { 3970 currentItem = $(this); 3971 currentItemIndex = items.index(currentItem); 3972 openItem(items, currentItemIndex, currentItem, selfAccordion, percent); 3973 3974 if (selfAccordion.find('.horizontal_accordionItem.moved').length) { 3975 selfAccordion.addClass('open'); 3976 } else { 3977 setTimeout(function () { 3978 selfAccordion.removeClass('open'); 3979 }, 400); 3980 } 3981 }); 3982 } 3983 }); 3984 3985 function openItem(items, currentItemIndex, currentItem, selfAccordion, percent) { 3986 var movedItems; 3987 var movingItems; 3988 var movingItemsIndex = currentItemIndex; 3989 3990 if (currentItem.hasClass('moved')) { 3991 movedItems = selfAccordion.find('.horizontal_accordionItem.moved'); 3992 movingItems = movedItems.slice(currentItemIndex, movedItems.length); 3993 3994 movedItems.each(function (i) { 3995 if (i >= movingItemsIndex) { 3996 setTimeout(function () { 3997 movedItems.eq(movingItemsIndex).css('transform', 'translateX(-' + percent * (movingItemsIndex) + '%)'); 3998 movingItemsIndex++; 3999 }, 50 * i); 4000 } 4001 4002 }); 4003 movingItems.removeClass('moved'); 4004 items.removeClass('active'); 4005 currentItem.addClass('active'); 4006 } else { 4007 movingItems = items.slice(0, currentItemIndex).addClass('moved'); 4008 4009 movingItems.each(function (i) { 4010 setTimeout(function () { 4011 items.eq(i).css('transform', 'translateX(-' + percent * (i + 1) + '%)'); 4012 }, 50 * i); 4013 }); 4014 4015 items.removeClass('active'); 4016 currentItem.addClass('active'); 4017 } 4018 } 4019 } 4020 $(window).on('ohio:handle_accordion_horizontal_box', handleHorizontalAccordion); 4021 4022 function handleBackLinkPosition() { 4023 var backLink = document.querySelectorAll('.clb-back-link'); 4024 var backLinkOffset = 0; 4025 4026 if ($("#wpadminbar").length) { 4027 backLinkOffset = backLinkOffset + $("#wpadminbar").height(); 4028 } 4029 4030 if (backLink.length && Clb.header && Clb.header.length) { 4031 var isTopHeader = Clb.header.hasClass('header-1') || Clb.header.hasClass('header-2') || Clb.header.hasClass('header-3') || Clb.header.hasClass('header-4'); 4032 4033 if (isTopHeader) { 4034 backLink[0].style.top = backLinkOffset + Clb.header.height() + 'px'; 4035 } 4036 backLink[0].classList.add('showed'); 4037 } 4038 } 4039 4040 function handleMasonry() { 4041 // Masonry && AOS 4042 4043 if ($('.ohio-masonry').length) { 4044 setTimeout(function () { 4045 $('.ohio-masonry').each(function () { 4046 var columnWidth = '.grid-item'; 4047 if ($(this).find('.grid-item').length == 0) { 4048 columnWidth = '.masonry-block'; 4049 } 4050 4051 $(this).masonry({ 4052 itemSelector: '.masonry-block', 4053 columnWidth: columnWidth, 4054 horizontalOrder: true, 4055 isAnimated: false, 4056 hiddenStyle: { 4057 opacity: 0, 4058 transform: '' 4059 } 4060 }); 4061 }); 4062 4063 setTimeout(function () { 4064 handleAOS(); 4065 }, 50); 4066 }, 50); 4067 } else { 4068 handleAOS(); 4069 } 4070 } 4071 $(window).on('ohio:handle_masonry', handleMasonry); 4072 4073 function handleScrollShareBar() { 4074 var mediaHolder = $('[data-scroll-share-bar]'); 4075 if (mediaHolder.length) { 4076 var windowHeigth = $(window).height()
4077 var mediaHolderHeight = mediaHolder.height(); 4078 var mediaHolderOffset = mediaHolder.offset().top; 4079 4080 $(window).on('scroll', function () { 4081 if ($(this).scrollTop() >= (mediaHolderHeight - windowHeigth) + mediaHolderOffset) { 4082 mediaHolder.addClass('scroll-end'); 4083 } else { 4084 mediaHolder.removeClass('scroll-end'); 4085 } 4086 }); 4087 } 4088 } 4089 4090 function handleCustomSelect() { 4091 var select = $('select:not(.select2-hidden-accessible)'); 4092 4093 select.each(function () { 4094 if (!$(this).parent().hasClass('select-holder')) { 4095 select.each(function () { 4096 $(this).wrapAll('<div class="select-holder"/>'); 4097 }); 4098 } 4099 }) 4100 } 4101 4102 function handleLanguageSelect() { 4103 var select = $('select.lang-dropdown-select'); 4104 4105 select.on('change', function () { 4106 window.location.href = this.value 4107 }); 4108 } 4109 4110 function handleDarkSectionColors() { 4111 var section = $('.clb__dark_section, .clb__light_section'); 4112 var sectionClass; 4113 4114 if (section.length) { 4115 var scrollTop = $('.clb-scroll-top'); 4116 var socialLinks = $('.clb-social'); 4117 var fixedSearch = $('.search-global.fixed .ion'); 4118 var dynamicHeader = $('.header-dynamic-typo'); 4119 var self_window; 4120 4121 activeSection($(window)); 4122 4123 $(window).on('scroll', function () { 4124 self_window = $(this); 4125 activeSection(self_window); 4126 }); 4127 4128 function activeSection(self_window) { 4129 var st = self_window.scrollTop() + self_window.height() / 2; 4130 section.each(function () { 4131 4132 var sectionOffset = $(this).offset().top; 4133 var currentSection = $(this); 4134 4135 //Fix for sticky footer 4136 if (currentSection.hasClass('site-footer sticky')) { 4137 if (!(st > ($(document).height() - self_window.height()))) { 4138 scrollTop.removeClass('dark-typo light-typo'); 4139 socialLinks.removeClass('dark-typo light-typo'); 4140 fixedSearch.removeClass('dark-typo light-typo'); 4141 dynamicHeader.removeClass('dark-typo light-typo'); 4142 return; 4143 } 4144 } 4145 4146 if (currentSection.hasClass('clb__dark_section')) { 4147 sectionClass = 'light-typo'; 4148 dynamicHeader.removeClass('dark-typo'); 4149 } else if (currentSection.hasClass('clb__light_section')) { 4150 sectionClass = 'dark-typo'; 4151 dynamicHeader.removeClass('light-typo'); 4152 } 4153 4154 if (sectionOffset + currentSection.outerHeight() > st && st > sectionOffset) { 4155 scrollTop.addClass(sectionClass); 4156 socialLinks.addClass(sectionClass); 4157 fixedSearch.addClass(sectionClass); 4158 dynamicHeader.addClass(sectionClass); 4159 4160 return false; 4161 } else { 4162 scrollTop.removeClass(sectionClass); 4163 socialLinks.removeClass(sectionClass); 4164 fixedSearch.removeClass(sectionClass); 4165 dynamicHeader.removeClass(sectionClass); 4166 } 4167 }); 4168 } 4169 } 4170 } 4171 4172 function handleRemoveSliderBulletsClass() { 4173 var slider = $('.project-fullscreen-slider.clb-slider, .portfolio-onepage-slider.clb-slider, .fullscreen-slider.clb-slider, .portfolio-onepage-slider.clb-smooth-slider'); 4174 var self_window; 4175 var body = $('body'); 4176 4177 if (slider.length && slider.find('.clb-slider-pagination').length) { 4178 if (slider.length && slider.offset().top <= $(window).scrollTop() + 50) { 4179 body.addClass('slider-with-bullets'); 4180 } 4181 } 4182 4183 $(window).on('scroll', function () { 4184 self_window = $(this); 4185 activeSection(self_window); 4186 }); 4187 4188 function activeSection(self_window) { 4189 var st = self_window.scrollTop() + self_window.height() / 2; 4190 slider.each(function () { 4191 4192 var sliderOffset = $(this).offset().top; 4193 var currentslider = $(this); 4194 4195 if (sliderOffset + currentslider.outerHeight() > st && st > sliderOffset) { 4196 body.addClass('slider-with-bullets'); 4197 return false;
4198 } else { 4199 body.removeClass('slider-with-bullets'); 4200 } 4201 }); 4202 } 4203 } 4204 $(window).on('ohio:handle_remove_slider_bullets', handleRemoveSliderBulletsClass); 4205 4206 function handlePageColorSwitcher() { 4207 var switcher = $('.clb-mode-switcher'); 4208 var switcherItems = switcher.find('.clb-mode-switcher-item, .clb-mode-switcher-toddler'); 4209 var coloredSections = $('.clb__light_section, .clb__dark_section'); 4210 var scrollTop = $('.clb-scroll-top'); 4211 var socialLinks = $('.clb-social'); 4212 var fixedSearch = $('.search-global.fixed .ion'); 4213 var dynamicHeader = $('.header-dynamic-typo'); 4214 4215 equalSize(switcherItems, 'width'); 4216 4217 if (Clb.body.hasClass('dark-scheme')) { 4218 switcher.addClass('dark'); 4219 } 4220 4221 if (document.cookie == 'ohio-swticher-state=dark') { 4222 coloredSections.toggleClass('clb__light_section clb__dark_section'); 4223 } 4224 4225 switcher.on('click', function () { 4226 $(Clb.body).addClass('switching'); 4227 $(Clb.body).toggleClass('dark-scheme'); 4228 $(this).toggleClass('dark'); 4229 4230 coloredSections.toggleClass('clb__light_section clb__dark_section'); 4231 4232 scrollTop.removeClass('dark-typo light-typo'); 4233 socialLinks.removeClass('dark-typo light-typo'); 4234 fixedSearch.removeClass('dark-typo light-typo'); 4235 dynamicHeader.removeClass('dark-typo light-typo'); 4236 4237 if (ohioVariables && ohioVariables.save_color_mode_state) { 4238 document.cookie = 'ohio-swticher-state=' + (($(Clb.body).hasClass('dark-scheme')) ? 'dark' : 'light'); 4239 } 4240 4241 4242 setTimeout(function () { 4243 $(Clb.body).removeClass('switching'); 4244 }, 10); 4245 }); 4246 } 4247 4248 function equalSize(items, attr) { 4249 var maxSize = 0; 4250 var value = 0; 4251 4252 items.each(function () { 4253 // .replace remove 'px' from returning value 4254 value = $(this).css(attr).replace(/(^\d+)(.+$)/i, '$1'); 4255 4256 if (value > maxSize) { 4257 maxSize = +($(this).css(attr).replace(/(^\d+)(.+$)/i, '$1')); 4258 } 4259 }); 4260 4261 var css = {}; 4262 css[attr] = maxSize; 4263 4264 items.css(css); 4265 } 4266 4267 4268 function percentagePreloader() { 4269 var counter = 0; 4270 var count = 0; 4271 var isLoad = false; 4272 4273 $(window).on('load', function () { 4274 isLoad = true; 4275 }); 4276 4277 setTimeout(function () { 4278 var breakPoint = Math.floor(Math.random() * 29) + 70; 4279 4280 var i = setInterval(function () { 4281 $(".sk-percentage .sk-percentage-percent").html(count + "%"); 4282 $(".sk-percentage").css("width", count + "%"); 4283 if (counter == 100) { 4284 clearInterval(i); 4285 setTimeout(function () { 4286 $("#page-preloader").addClass('hidden'); 4287 }, 10) 4288 4289 } else if (counter == breakPoint) { 4290 4291 if (isLoad) { 4292 counter++; 4293 count++; 4294 } else { 4295 counter = breakPoint; 4296 count = breakPoint; 4297 } 4298 4299 } else { 4300 counter++; 4301 count++; 4302 } 4303 }, 12); 4304 }); 4305 } 4306 4307 function handleInteractiveLinksGrid() { 4308 var grid = $('[data-interactive-links-grid]'); 4309 var gridItems = grid.find('.portfolio-item-wrap '); 4310 createImagesForInteractiveLinksGrid(grid.find('[data-lazy-container]')); 4311 var gridImages = $('.portfolio-grid-images .portfolio-metro-image') 4312 4313 gridItems.each(function () { 4314 var self = $(this); 4315 4316 self.mouseenter(function () { 4317 self.find('.portfolio-item').addClass('visible'); 4318 gridItems.find('.portfolio-item').not('.visible').addClass('invisible'); 4319 gridImages.eq(self.index()).addClass('scale'); 4320 }).mouseleave(function () { 4321 gridItems.find('.portfolio-item').removeClass('invisible visible'); 4322 gridImages.removeClass('scale'); 4323 }); 4324 }); 4325 } 4326 $(window).on('ohio:handle_interactive_links_grid', handleInteractiveLinksGrid); 4327 4328 function createImagesForInteractiveLinksGrid(grid) { 4329 var gridItem = grid.find('[data-featured-image]'); 4330 var gridImages = $('.interactive-links-grid-images'); 4331 gridImages.empty(); 4332 4333 gridItem.each(function () { 4334 var bgImage = $('<div class="portfolio-metro-image interactive-links-grid-image"></div>'); 4335 bgImage.css('background-image', 'url(' + $(this).data('featured-image') + ')'); 4336 gridImages.append(bgImage); 4337 }); 4338 } 4339 4340 function handlePortfolioMovingDetailsGrid() { 4341 var grid = $(".grid_11"); 4342 if (grid.length) {
4343 var portfolioItem = grid.find('.portfolio-grid-type-11'); 4344 4345 portfolioItem.on('mouseover mousemove', function (event) { 4346 $(this).find('.portfolio-item-details')[0].style.transform = 'translate(' + event.clientX + 'px, ' + event.clientY + 'px' + ')'; 4347 }); 4348 4349 portfolioItem.on('mouseleave', function (event) { 4350 $(this).find('.portfolio-item-details')[0].style.transform = 'translate(0px, 0px' + ')'; 4351 }); 4352 } 4353 } 4354 $(window).on('ohio:handle_portfolio_moving_details_grid', handlePortfolioMovingDetailsGrid); 4355 4356 function handleProjectScrollScale() { 4357 var project = $('.scroll-scale-image'); 4358 var projectImage = project.find('.project-page-media-holder .project-image'); 4359 if (projectImage.length) { 4360 var scale = 1.0; 4361 var lastScrollTop = 0; 4362 var projectImageOffset = projectImage.offset().top; 4363 var projectImageHeight = projectImage.height(); 4364 var wndHeight = $(window).height(); 4365 var projectImageHeight = projectImage.height(); 4366 var modifier = 0; 4367 4368 //(-parallaxTop + contentScroll + wndHeight) / (parallaxHeight + wndHeight) 4369 4370 $(window).on('scroll', function () { 4371 var st = $(this).scrollTop(); 4372 modifier = ((st) / (projectImageHeight + wndHeight) / 5); 4373 4374 if (st < projectImageOffset + projectImageHeight) { 4375 if (st > lastScrollTop) { 4376 //Down 4377 setTimeout(function () { 4378 projectImage.css('transform', 'scale(' + scale + ')'); 4379 scale = 1 + modifier; 4380 }, 50); 4381 } 4382 else { 4383 //Up 4384 projectImage.css('transform', 'scale(' + scale + ')'); 4385 if (scale > 1.005) { 4386 scale = 1 + modifier; 4387 } 4388 } 4389 } 4390 lastScrollTop = st; 4391 }); 4392 } 4393 } 4394 4395 function handleGlobalPageAnimation() { 4396 var isGLobalAnim = $('.global-page-animation'); 4397 4398 if (isGLobalAnim.length) { 4399 var isURIPrefix = false; 4400 4401 $('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)').on('click', function (e) { 4402 var link = $(this).attr('href'); 4403 4404 if (link.indexOf('http') == -1 && link.indexOf(':') != -1) { 4405 isURIPrefix = true 4406 } 4407 4408 if (link && link.charAt(0) != '#' && $(this).attr('target') != '_blank' && !isURIPrefix) { 4409 e.preventDefault(); 4410 isGLobalAnim.removeClass('global-page-animation-active'); 4411 isGLobalAnim.addClass('global-page-animation-fade-out') 4412 setTimeout(function () { 4413 $('.page-preloader:not(.percentage-preloader)').removeClass('hidden'); 4414 }, 800); 4415 4416 setTimeout(function () { 4417 document.location.href = link; 4418 }, 850); 4419 } 4420 }); 4421 } 4422 } 4423 $(window).on('ohio:handle_global_page_animation', handleGlobalPageAnimation); 4424 4425 function handleStickySection() { 4426 var sticky = $('.sticky-section'); 4427 4428 if (sticky.length) { 4429 4430 sticky.each(function () { 4431 4432 var secondImage = $(this).find('.sticky-section-item-second-image'); //projectImage 4433 var lastScrollTop = 0; 4434 var stickyItemHeight = $('.sticky-section-item').height(); 4435 var stickyItemOffset = $('.sticky-section-item').offset().top; //projectImageOffset 4436 var secondImageHeight = secondImage.height(); //projectImageHeight 4437 var wndHeight = $(window).height(); 4438 var modifier = 0; 4439 var inset = secondImageHeight; 4440 4441 $(window).on('scroll', function () { 4442 var st = $(this).scrollTop(); 4443 modifier = ((st) / (secondImageHeight + wndHeight)) * 20; //((st) / (secondImageHeight + wndHeight) / 5) 4444 if (st > stickyItemOffset + ((stickyItemHeight / 2) - secondImageHeight)) { 4445 if (st > lastScrollTop) { 4446 //Down 4447 if (inset > 0) { 4448 secondImage.css('clip-path', 'inset(' + inset + 'px 0px 0px)'); 4449 inset = inset - modifier; 4450 } 4451 } 4452 else { 4453 //Up 4454 if (inset < secondImageHeight) { 4455 secondImage.css('clip-path', 'inset(' + inset + 'px 0px 0px)'); 4456 inset = inset + modifier; 4457 } 4458 } 4459 } 4460 lastScrollTop = st; 4461 }); 4462 4463 }); 4464 4465 } 4466 } 4467 4468 function handleZoomProductImage() {
4469 $('.woo_c-product-image.with-zoom .product_images .image-wrap') 4470 .on('mouseover', function () { 4471 $(this).find('img').css({ 'transform': 'scale(1.5)' }); 4472 }) 4473 .on('mouseout', function () { 4474 $(this).find('img').css({ 'transform': 'scale(1)' }); 4475 }) 4476 .on('mousemove', function (e) { 4477 $(this).find('img').css({ 'transform-origin': ((e.pageX - $(this).offset().left) / $(this).width()) * 100 + '% ' + ((e.pageY - $(this).offset().top) / $(this).height()) * 100 + '%' }); 4478 }) 4479 } 4480 4481 function contactFormAcceptenceField() { 4482 var acceptenceCheckbox = $('#form_privacy_policy'); 4483 4484 acceptenceCheckbox.each(function () { 4485 if ($(this).length) { 4486 $(this).parents('.wpcf7-form').find('.btn').prop('disabled', true); 4487 } 4488 }); 4489 4490 acceptenceCheckbox.on('change', function () { 4491 if ($(this).is(':checked')) { 4492 $(this).parents('.wpcf7-form').find('.btn').prop('disabled', false); 4493 } else { 4494 $(this).parents('.wpcf7-form').find('.btn').prop('disabled', true); 4495 } 4496 }); 4497 } 4498 4499 function portfolioGridType12() { 4500 var portfolioGrid = $('.grid_12'); 4501 4502 portfolioGrid.each(function () { 4503 4504 var gridHolder = $(this).find('.portfolio-grid-holder'); 4505 var gridHolderWidth = gridHolder.width(); 4506 var grid = $(this).find('.portfolio-grid'); 4507 var gridHeight = grid.width(); 4508 var gridItems = $(this).find(' .grid-item'); 4509 var filterBar = $(this).find('.portfolio-sorting'); 4510 var underline = gridHolder.find('.portfolio-grid-holder-underline'); 4511 var windwoWidth = $(window).width(); 4512 var windwoHeight = $(window).height(); 4513 4514 cloneImagesForPortfolioGridType12($(this)); 4515 var gridImages = $('.interactive-links-grid-images .portfolio-item-image'); 4516 4517 4518 if (filterBar.length) { 4519 grid.css('top', filterBar.outerHeight() + 'px'); 4520 } 4521 4522 4523 if (!Clb.isMobile) { 4524 gridHolder.height(gridHeight); 4525 grid.height(gridHolderWidth); 4526 4527 setTimeout(function () { 4528 underline.width(gridItems.eq(0).height()); 4529 underline.height(1); 4530 }, 300); 4531 4532 } else { 4533 setTimeout(function () { 4534 underline.height(gridItems.eq(0).height()); 4535 underline.width(1); 4536 }, 300); 4537 } 4538 4539 4540 gridItems.each(function () { 4541 var gridItem = $(this); 4542 var gridItemOffsetLeft = gridItem.offset().left; 4543 4544 var gridImage = gridImages.eq(gridItem.index()); 4545 var gridImageInnerContainer = gridImage.find('.portfolio-item-image-container'); 4546 var gridImageWidth = gridImage.width(); 4547 var gridImageHeight = gridImage.height(); 4548 4549 var lastMouseXPosition = 0; 4550 var lastMouseYPosition = 0; 4551 var moveTimer; 4552 4553 gridItem.find('.portfolio-item').on('mouseover mousemove', function (event) { 4554 4555 //If mousemove is stopped 4556 clearTimeout(moveTimer); 4557 moveTimer = setTimeout(function () { 4558 gridImageInnerContainer[0].style.transform = 'rotate(0deg)'; 4559 }, 200); 4560 4561 var y = event.clientY; 4562 var x = event.clientX; 4563 4564 var mouseYPosition = event.clientY; 4565 4566 var underlinePosition = $(this).offset().left - gridHolder.offset().left; 4567 4568 var rotateIndex = ((y - lastMouseYPosition) + (x - lastMouseXPosition)) / -1; 4569 4570 if (gridItemOffsetLeft > (windwoWidth / 2)) { 4571 x -= gridImageWidth / 2; 4572 } 4573 4574 if (mouseYPosition > (windwoHeight / 1.5)) { 4575 y -= gridImageHeight; 4576 } 4577 4578 if (Clb.isMobile) { 4579 underlinePosition = $(this).offset().top - gridHolder.offset().top; 4580 underline[0].style.transform = 'translateY(' + underlinePosition + 'px)'; 4581 } else { 4582 underline[0].style.transform = 'translateX(' + underlinePosition + 'px)'; 4583 } 4584 4585 gridImage.addClass('visible'); 4586 gridImage[0].style.transform = 'translate(' + x + 'px, ' + y + 'px' + ')'; 4587 gridImageInnerContainer[0].style.transform = 'rotate(' + rotateIndex + 'deg)'; 4588 gridImageInnerContainer[0].style.filter = 'brightnes(' + rotateIndex + ')'; 4589 4590 setTimeout(function () { 4591 gridImage.addClass('animate'); 4592 }, 1); 4593 4594 lastMouseXPosition = event.clientX; 4595 lastMouseYPosition = event.clientY; 4596 4597 }); 4598 4599 gridItem.find('.portfolio-item').on('mouseleave', function (event) { 4600 gridImage.removeClass('visible'); 4601 gridImage[0].style.transform = 'translate(0px, 0px)'; 4602 gridImageInnerContainer[0].style.transform = 'rotate(0deg)'; 4603 4604 setTimeout(function () { 4605 gridImage.removeClass('animate'); 4606 }, 1); 4607 }); 4608 4609 gridItem.on("mouseout", function () { 4610 clearTimeout(moveTimer); 4611 }); 4612 }); 4613 }); 4614 } 4615 $(window).on('ohio:portfolioGridType12', portfolioGridType12); 4616 4617 function cloneImagesForPortfolioGridType12(grid) { 4618 var gridItem = grid.find(' .grid-item'); 4619 var gridImages = $('.interactive-links-grid-images'); 4620 4621 gridImages.empty(); 4622 4623 gridItem.each(function () { 4624 var itemImage = $(this).find('.portfolio-item-image'); 4625 gridImages.append(itemImage.clone()); 4626 }); 4627 } 4628 4629 function getMaxPropertySize(elements, property) { 4630 var maxPropertySize = 0; 4631 4632 elements.each(function () { 4633 4634 var itemPropertySize = $(this).css(property).replace(/(^\d+)(.+$)/i, '$1'); 4635 4636 if (itemPropertySize > maxPropertySize) { 4637 maxPropertySize = itemPropertySize; 4638 } 4639 4640 }); 4641
4642 return maxPropertySize 4643 4644 } 4645 4646 function asymmetricParallaxGrid() { 4647 // var asymmetricGrid = $('[data-asymmetric-parallax-grid]'); 4648 4649 // if (asymmetricGrid.data('asymmetric-parallax-grid')) { 4650 // var gridItems = $('[data-asymmetric-parallax-grid]').children(); 4651 // var loopCount = 1; 4652 // var gridTop = asymmetricGrid.offset().top; 4653 // var gridHeight = asymmetricGrid.height(); 4654 // var speed = asymmetricGrid.data('asymmetric-parallax-speed') / 100; 4655 // var grid = asymmetricGrid.data('grid-number').split('-'); 4656 // var gridNumber = getGridNumber(grid); 4657 4658 // //Establish modifier for each element 4659 // if (asymmetricGrid.hasClass('ohio-masonry') || asymmetricGrid.data('isotope-grid') ) { 4660 // setTimeout(function(){ 4661 // var itemLeftOffset = 0; 4662 // var countOffsets = []; 4663 4664 // //Get offset for each column 4665 // for (var i = 0; i < gridNumber; i++ ) { 4666 // let itemLeftOffset = gridItems[i].style.left.replace(/(^\d+)(.+$)/i,'$1'); 4667 // countOffsets.push(itemLeftOffset); 4668 // } 4669 4670 // gridItems.each(function(i){ 4671 // itemLeftOffset = this.style.left.replace(/(^\d+)(.+$)/i,'$1'); 4672 // //Set data order equal 4673 // for (var i = 0; i < countOffsets.length; i++ ) { 4674 // if (itemLeftOffset == countOffsets[i]) { 4675 // $(this).data('data-order', i + 1); 4676 // $(this).data('position', 0); 4677 // } 4678 // } 4679 // }); 4680 // }, 101); 4681 // } else { 4682 // gridItems.each(function(i){ 4683 // $(this).data('data-order', loopCount); 4684 // $(this).data('position', 0); 4685 // loopCount++; 4686 4687 // if (loopCount > gridNumber) { 4688 // loopCount = 1; 4689 // } 4690 // }); 4691 // } 4692 4693 // var params = { 4694 // 'gridTop': gridTop, 4695 // 'gridHeight': gridHeight, 4696 // 'speed': speed 4697 // }; 4698 4699 // asymmetricGrid.addClass('clb-asymmetric-parallax-grid'); 4700 4701 // $(window).on('scroll mousewheel', function (e) { 4702 // handleAsymmetricParallaxGrid(params, e); 4703 // }); 4704 4705 // function getGridNumber(grid) { 4706 // if (Clb.isMobile) { 4707 4708 // if (grid[2] == 'i') { 4709 // return 1; 4710 // } 4711 4712 // return grid[2]; 4713 // } else if (Clb.isPad) { 4714 4715 // if (grid[1] == 'i') { 4716 // return 2; 4717 // } 4718 4719 // return grid[1]; 4720 // } else { 4721 4722 // if (grid[0] == 'i') { 4723 // return 3; 4724 // } 4725 4726 // return grid[0]; 4727 // } 4728 // } 4729 // } 4730 } 4731 4732 function handleAsymmetricParallaxGrid(params, e) { 4733 // var contentScroll = $(document).scrollTop(); 4734 // var wndHeight = $(window).height(); 4735 4736 // var isnotStartOrEndDocument = (contentScroll != 0) && ($(document).height() != contentScroll + $(window).height()); 4737 // var isGridOnScreen = (params['gridTop'] <= contentScroll + wndHeight) && (params['gridTop'] + params['gridHeight'] >= contentScroll); 4738 4739 // if (isGridOnScreen && isnotStartOrEndDocument) { 4740 // $('[data-asymmetric-parallax-grid] > *').each(function(){ 4741 4742 // if (e.originalEvent.wheelDelta > 0) { 4743 // var newPosition = ($(this).data('position') + (params['speed'] * ($(this).data('data-order') * 2))); 4744 // } else { 4745 // var newPosition = ($(this).data('position') - (params['speed'] * $(this).data('data-order'))); 4746 // } 4747 4748 // $(this).data('position', newPosition); 4749 // $(this).css('transform', 'translate3d(0, ' + newPosition + 'px, 0)'); 4750 // }); 4751 // } else if (!isGridOnScreen) { 4752 // $('[data-asymmetric-parallax-grid] > *').each(function(){ 4753 // $(this).css('transform', 'translate3d(0, 0, 0)'); 4754 // $(this).data('position', 0); 4755 // }); 4756 // } 4757 } 4758 4759 function handleOhioBgImages() { 4760 $('[data-ohio-bg-image]').each(function () { 4761 $(this).css('background-image', 'url(' + $(this).attr('data-ohio-bg-image') + ')'); 4762 }); 4763 } 4764 $(window).on('ohio:handle_bg_images', handleOhioBgImages); 4765 4766 function handleOhioDynamicTextSc() { 4767 $('div[data-dynamic-text="true"]').each(function () { 4768 var options = JSON.parse($(this).attr('data-dynamic-text-options')); 4769 new Typed('#' + $(this).attr('id') + ' .dynamic', options); 4770 }); 4771 } 4772 setTimeout(function () { 4773 $(window).on('ohio:handle_ohio_dynamic_text', handleOhioDynamicTextSc); 4774 }, 1000) 4775 4776 4777 percentagePreloader(); 4778 wideMenuOnLoadPosition(); 4779 4780 window.ohioRefreshFrontEnd = function () { 4781 handleAccordionBox(); 4782 handleBannerBox(); 4783 handleBannerBoxSize(); 4784 handleCounterBox(); 4785 handleCountdownBox(); 4786 handleSubscribeContactForm(); 4787 handleCoverBox(); 4788 handleCoverBoxSize(); 4789 handleGallery(); 4790 // handleSocialBar(); 4791 handleSplitboxParallax(); 4792 handleProgressBar(); 4793 handleProgressBarSize(); 4794 initParallax(); 4795 handleParallax(); 4796 handlePriceTable(); 4797 handleTabBox();
4798 handleVideoBackground(); 4799 handleVideoPopup(); 4800 handleScrollEffects(); 4801 handleSliders(); 4802 }; 4803 4804 handleMobileHeader(); 4805 $(window).on('load', function () { 4806 4807 Clb.init(); 4808 handleOhioHeight(); 4809 4810 // Navigation 4811 if (!Clb.isMobileMenu && Clb.headerIsFifth) { 4812 centeredLogo(); 4813 } 4814 handleNavigations(); 4815 4816 //countMenuItems(); 4817 4818 // Header 4819 handleHeaders(); 4820 handleHeaderTitle(); 4821 4822 4823 handleCustomSelect(); 4824 handleLanguageSelect(); 4825 4826 // Footer 4827 handleFooter(); 4828 handleFooterSize(); 4829 handleStretchContent(); 4830 4831 // Shortcodes 4832 handleAccordionBox(); 4833 handleAccordionBoxSize(); 4834 handleBannerBox(); 4835 handleBannerBoxSize(); 4836 handleCounterBox(); 4837 handleCountdownBox(); 4838 handleSubscribeContactForm(); 4839 handleCoverBox(); 4840 handleCoverBoxSize(); 4841 handleGallery(); 4842 handleFullscreenSlider(); 4843 handleCircleProgressBar(); 4844 handleTeamMemberInner(); 4845 handleHorizontalAccordion(); 4846 handleSliders(); 4847 handleStickySection(); 4848 // handleSocialBar(); 4849 handleSplitboxParallax(); 4850 handleProgressBar(); 4851 handleProgressBarSize(); 4852 initParallax(); 4853 handleParallax(); 4854 handlePriceTable(); 4855 handleTabBox(); 4856 handleVideoBackground(); 4857 handleVideoPopup(); 4858 4859 // Shop 4860 handleShopMasonry(); 4861 handleStickyProduct(); 4862 handleMobileFilter(); 4863 handleQuickviewPopup(); 4864 handleSingleProductGallery(); 4865 handleProductsGridGallery(); 4866 handleZoomProductImage(); 4867 4868 // Portfolio 4869 handlePortfolio(); 4870 if (!Clb.isPad) { 4871 handleScrollContent(); 4872 } 4873 handleScrollShareBar(); 4874 handleScrollEffects(); 4875 handleLazyLoadClick(); 4876 handleLazyLoadScroll(); 4877 handlePortfolioOnepageSlider(); 4878 handlePortfolioPopup(); 4879 handleScrollMeter(); 4880 handleMutationObserver(); 4881 if (!Clb.isPad) { 4882 handleBgParallaxEffect(); 4883 } 4884 handleBackLinkPosition(); 4885 handleRemoveSliderBulletsClass(); 4886 handleInteractiveLinksGrid(); 4887 handlePortfolioMovingDetailsGrid(); 4888 handleProjectScrollScale(); 4889 portfolioGridType12(); 4890 4891 handleMasonry(); 4892 asymmetricParallaxGrid(); 4893 contactFormAcceptenceField(); 4894 //Custom cursor 4895 if (!Clb.isPad) { 4896 handleCustomCursor(); 4897 } 4898 4899 handleDarkSectionColors(); 4900 4901 handlePageColorSwitcher(); 4902 handleGlobalPageAnimation(); 4903 boxedPageRowWidth(); 4904 4905 setTimeout(function () { 4906 handleAlignContentInStretchRow(); 4907 handleSliders(); 4908 }, 10); 4909 4910 // SlideUp animated elements 4911 $('.clb-slider-item').each(function () { 4912 if ($(this).hasClass('active')) { 4913 $(this).find('.animated-holder').addClass('visible'); 4914 } 4915 }) 4916 4917 //Buttons 4918 4919 btnPreloader(); 4920 4921 //logo SC 4922 logoOverlay(); 4923 4924 //Important for mobile menu 4925 Clb.body.addClass('page-is-loaded'); 4926 4927 // Scroll top button 4928 $('.clb-scroll-top').on("click", function () { 4929 $('html, body').animate({ scrollTop: 0 }, 800); 4930 return false; 4931 }); 4932 4933 // Tooltips 4934 $('.tooltip').each(function () { 4935 if ($(this).find('.tooltip-top, .tooltip-bottom').length) { 4936 var content = $(this).find('.tooltip-text'); 4937 content.css('left', ($(this).outerWidth() / 2 - content.outerWidth() / 2) + 'px'); 4938 } 4939 }); 4940 4941 // Message boxes 4942 $('body').on('click', '.message-box .clb-close', function () { 4943 $(this).parent().slideUp({ duration: 300, queue: false }).fadeOut(300); 4944 var self = $(this); 4945 setTimeout(function () { 4946 self.remove(); 4947 }, 350); 4948 }); 4949 4950 $('body').on('click', '.notification-bar .clb-close', function (e) { 4951 e.preventDefault(); 4952
4953 setCookie('notification', 'enabled', +ohioVariables.notification_expires); 4954 $(this).parents('.notification-bar').removeClass('active'); 4955 }); 4956 4957 // Ohio attrs 4958 handleOhioBgImages(); 4959 4960 // Fixed google maps equal height in percent 4961 $('.wpb_wrapper').each(function () { 4962 var divs = $(this).find('> div'); 4963 4964 if (divs.length == 1 && divs.eq(0).hasClass('google-maps')) { 4965 $(this).css('height', '100%'); 4966 } 4967 }); 4968 4969 handleOhioDynamicTextSc(); 4970 4971 // Refresh composter waypoints after magic 4972 if (window.vc_waypoints) { 4973 setTimeout(function () { 4974 window.vc_waypoints(); 4975 }, 600); 4976 } 4977 4978 // Mobile share button 4979 $('.mobile-social').on('click', function (e) { 4980 e.stopPropagation(); 4981 4982 if ($(this).hasClass('active')) { 4983 $(this).find('.social').css('height', '0px'); 4984 $(this).removeClass('active'); 4985 } else { 4986 var social = $(this).find('.social'); 4987 var self = $(this); 4988 4989 social.css('height', ''); 4990 4991 social.addClass('no-transition'); 4992 4993 $(this).addClass('active'); 4994 var height = social.outerHeight(); 4995 $(this).removeClass('active'); 4996 4997 setTimeout(function () { 4998 social.css('height', height + 'px'); 4999 social.removeClass('no-transition'); 5000 self.addClass('active'); 5001 }, 50); 5002 5003 } 5004 }); 5005 5006 $(window).on('scroll', function () { 5007 var handleAnim = function () { 5008 handleMobileHeader(); 5009 handleFixedHeader(); 5010 handleHeaderTitle(); 5011 handleBarScroll(); 5012 handleCounterBox(); 5013 handleProgressBar(); 5014 handleParallax(); 5015 handleScrollEffects(); 5016 handleLazyLoadScroll(); 5017 handleScrollMeter(); 5018 }; 5019 5020 if (window.requestAnimationFrame) { 5021 window.requestAnimationFrame(function () { 5022 handleAnim(); 5023 }); 5024 } else { 5025 handleAnim(); 5026 } 5027 5028 // Scroll top 5029 5030 if ($(window).scrollTop() > 250) { 5031 $('.clb-scroll-top').addClass('visible'); 5032 } else { 5033 $('.clb-scroll-top').removeClass('visible'); 5034 } 5035 }); 5036 5037 //For disebling resize trigger on mobile scroll 5038 var mobileResizeWidth = $(window).width(), mobileResizeHeight = $(window).height(); 5039 5040 $(window).on('resize', function () { 5041 Clb.resize(); 5042 handleOhioHeight(); 5043 handleHeaderSize(); 5044 handleHeaderTitle(); 5045 handleFooterSize(); 5046 handleStretchContent(); 5047 handleAccordionBoxSize(); 5048 handleBannerBoxSize(); 5049 handleCounterBox(); 5050 handleCoverBox(); 5051 handleCoverBoxSize(); 5052 handleParallax(); 5053 handleProgressBarSize(); 5054 handlePriceTable(); 5055 handleTabBoxSize(); 5056 handleProgressBar(); 5057 handleScrollEffects(); 5058 handleLazyLoadScroll(); 5059 handleShopMasonry(); 5060 handleScrollShareBar(); 5061 handleHorizontalAccordion(); 5062 handleMobileHeader(); 5063 handleTabBox(); 5064 boxedPageRowWidth(); 5065 wideMenuOnResizePosition(); 5066 5067 setTimeout(function () { 5068 handleAlignContentInStretchRow(); 5069 handleMasonry(); 5070 5071 if (Clb.isElementorPage) { 5072 handleAccordionBoxSize(); 5073 } 5074 5075 portfolioGridType12(); 5076 5077 }, 400); 5078 5079 if (!Clb.isMobileMenu && Clb.headerIsFifth && Clb.header && Clb.header.length) { 5080 if (Clb.header.hasClass('header-4')) { 5081 setTimeout(function () { 5082 Clb.header.find('.nav').removeAttr('style'); 5083 centeredLogo(); 5084 }, 100); 5085 } 5086 } 5087 5088 if (Clb.isPad) { 5089 mobileSubMenuCalcHeight(); 5090 } 5091 5092 //For disebling resize trigger on mobile scroll 5093 if ($(window).width() !== mobileResizeWidth) { 5094 handleSingleProductGallery(); 5095 handleProductsGridGallery(); 5096 handleSliders(); 5097 } 5098 5099 if (Clb.isMobileMenu) { 5100 if (Clb.headerIsFifth) { 5101 $('#site-navigation, .left-part, .right-part, .nav-item').removeAttr('style'); 5102 } 5103 } 5104 5105 if (typeof (AOS) != 'undefined') { 5106 setTimeout(function () { 5107 AOS.refresh(); 5108 }, 10); 5109 // Isotope animation 5110 setTimeout(function () { 5111 AOS.refresh(); 5112 5113 if (window.vc_waypoints) { 5114 window.vc_waypoints(); 5115 } 5116 }, 600); 5117 } 5118
5119 if ($('[data-portfolio-grid-slider]').hasClass('grid_6')) { 5120 calcHeightForOnepageItemsOverlay(); 5121 } 5122 5123 //Custom cursor 5124 if (!Clb.isPad) { 5125 handleCustomCursor(); 5126 } 5127 }); 5128 5129 $('#page-preloader:not(.percentage-preloader), .container-loading').addClass('hidden'); 5130 5131 var userAgent = navigator.userAgent.toLowerCase(); 5132 var isSafari = false 5133 5134 if (userAgent.indexOf('safari') != -1) { 5135 if (userAgent.indexOf('chrome') > -1) { 5136 isSafari = false; // Chrome 5137 } else { 5138 isSafari = true; // Safari 5139 } 5140 } 5141 5142 if (navigator.userAgent.match(/(iPod|iPhone|iPad)/) || isSafari) { 5143 window.onpageshow = function (event) { 5144 if (event.persisted) { 5145 window.location.reload(); 5146 } 5147 }; 5148 } 5149 5150 if (Clb.body.hasClass('global-page-animation')) { 5151 Clb.body.addClass('global-page-animation-active'); 5152 } 5153 5154 $('.gimg').css('opacity', '1'); 5155 5156 handleCompareShortcodes(); 5157 }); 5158 5159 // Compare SC 5160 function handleCompareShortcodes() { 5161 $('.compare-shortcode').each(function () { 5162 var $this = $(this); 5163 5164 $this.twentytwenty({ 5165 no_overlay: $this.attr('data-compare-without-overlay'), 5166 before_label: $this.attr('data-compare-before-label'), 5167 after_label: $this.attr('data-compare-after-label'), 5168 orientation: $this.attr('data-compare-orientation'), 5169 default_offset_pct: parseFloat($this.attr('data-compare-position')), 5170 }); 5171 5172 var twentyHandle = $this.find('.twentytwenty-handle'); 5173 twentyHandle.find('.twentytwenty-left-arrow, .twentytwenty-right-arrow').remove(); 5174 twentyHandle.each(function () { 5175 $(this).append('<div class="twentytwenty-arrows cursor-magnet"><i class="ion ion-ios-code"></i></div>'); 5176 }); 5177 }); 5178 } 5179 $(window).on('ohio:handle_compare_shortcodes', handleCompareShortcodes); 5180 5181 // Custom cursor 5182 function handleCustomCursor() { 5183 const cursorInnerEl = document.querySelector('.circle-cursor--inner'); 5184 const cursorOuterEl = document.querySelector('.circle-cursor--outer'); 5185 5186 if ($('body').hasClass('custom-cursor') && cursorInnerEl && cursorOuterEl) { 5187 let lastY, lastX = 0; 5188 let magneticFlag = false; 5189 5190 // move 5191 window.onmousemove = function (event) { 5192 if (!magneticFlag) { 5193 cursorOuterEl.style.transform = 'translate(' + event.clientX + 'px, ' + event.clientY + 'px' + ')'; 5194 5195 /*Old code*/ 5196 // cursorOuterEl.style.top = event.clientY + 'px'; 5197 // cursorOuterEl.style.left = event.clientX + 'px'; 5198 } 5199 cursorInnerEl.style.transform = 'translate(' + event.clientX + 'px, ' + event.clientY + 'px' + ')'; 5200 5201 /*Old code*/ 5202 // cursorInnerEl.style.top = event.clientY + 'px'; 5203 // cursorInnerEl.style.left = event.clientX + 'px'; 5204 lastY = event.clientY; 5205 lastX = event.clientX; 5206 } 5207 5208 // links hover 5209 $('body').on('mouseenter', 'a, .cursor-as-pointer', function () { 5210 cursorInnerEl.classList.add('cursor-link-hover'); 5211 cursorOuterEl.classList.add('cursor-link-hover'); 5212 }); 5213 $('body').on('mouseleave', 'a, .cursor-as-pointer', function () { 5214 if ($(this).is('a') && $(this).closest('.cursor-as-pointer').length) { 5215 return; 5216 } 5217 cursorInnerEl.classList.remove('cursor-link-hover'); 5218 cursorOuterEl.classList.remove('cursor-link-hover'); 5219 }); 5220 5221 // additional hover cursor class 5222 $('body').on('mouseenter', '[data-cursor-class]', function () { 5223 const cursorClass = $(this).attr('data-cursor-class'); 5224 // cursorInnerEl.classList.add(cursorClass); 5225 // cursorOuterEl.classList.add(cursorClass); 5226 5227 if (cursorClass.indexOf('dark-color') != -1) { 5228 cursorInnerEl.classList.add('dark-color'); 5229 cursorOuterEl.classList.add('dark-color'); 5230 } 5231 5232 if (cursorClass.indexOf('cursor-link') != -1) { 5233 cursorInnerEl.classList.add('cursor-link'); 5234 cursorOuterEl.classList.add('cursor-link'); 5235 } 5236 }); 5237 $('body').on('mouseleave', '[data-cursor-class]', function () { 5238 const cursorClass = $(this).attr('data-cursor-class'); 5239 if (cursorClass.indexOf('dark-color') != -1) { 5240 cursorInnerEl.classList.remove('dark-color'); 5241 cursorOuterEl.classList.remove('dark-color'); 5242 } 5243 5244 if (cursorClass.indexOf('cursor-link') != -1) { 5245 cursorInnerEl.classList.remove('cursor-link'); 5246 cursorOuterEl.classList.remove('cursor-link'); 5247 } 5248 }); 5249 5250 // magnet elements 5251 $('body').on('mouseenter', '.cursor-magnet, .btn-round', function () { 5252 const $elem = $(this); 5253 const scrollTop = window.pageYOffset || document.documentElement.scrollTop; 5254 5255 cursorOuterEl.style.transition = 'all .2s ease-out'; 5256 cursorOuterEl.style.transform = 'translate(' + $elem.offset().left + 'px, ' + ($elem.offset().top - scrollTop) + 'px' + ')'; 5257 5258 /*Old code*/ 5259 // cursorOuterEl.style.top = ($elem.offset().top - scrollTop) + 'px'; 5260 // cursorOuterEl.style.left = $elem.offset().left + 'px'; 5261 cursorOuterEl.style.width = $elem.width() + 'px'; 5262 cursorOuterEl.style.height = $elem.height() + 'px'; 5263 cursorOuterEl.style.marginLeft = 0; 5264 cursorOuterEl.style.marginTop = 0; 5265 5266 magneticFlag = true; 5267 }); 5268 5269 $('body').on('mouseleave', '.cursor-magnet, .btn-round', ohioRemoveMagneticFromCursor); 5270 5271 function ohioRemoveMagneticFromCursor() { 5272 cursorOuterEl.style.transition = null; 5273 cursorOuterEl.style.width = null; 5274 cursorOuterEl.style.height = null; 5275 cursorOuterEl.style.marginLeft = null; 5276 cursorOuterEl.style.marginTop = null; 5277 5278 /*Old code*/ 5279 // cursorOuterEl.style.top = lastY + 'px'; 5280 // cursorOuterEl.style.left = lastX + 'px'; 5281 5282 magneticFlag = false;
5283 } 5284 5285 // Custom leave trigger 5286 $('body').on('ohio:cursor_mouseleave', function () { 5287 ohioRemoveMagneticFromCursor(); 5288 5289 cursorOuterEl.style.transform = cursorInnerEl.style.transform; 5290 5291 cursorInnerEl.classList.remove('cursor-link-hover'); 5292 cursorOuterEl.classList.remove('cursor-link-hover'); 5293 5294 }); 5295 5296 //iframe fix 5297 $('body').on('mouseenter', 'iframe', function () { 5298 cursorOuterEl.style.visibility = 'hidden'; 5299 cursorInnerEl.style.visibility = 'hidden'; 5300 }); 5301 $('body').on('mouseleave', 'iframe', function () { 5302 cursorOuterEl.style.visibility = 'visible'; 5303 cursorInnerEl.style.visibility = 'visible'; 5304 }); 5305 5306 cursorInnerEl.style.visibility = 'visible'; 5307 cursorOuterEl.style.visibility = 'visible'; 5308 } 5309 } 5310 5311 if ($('body').hasClass('ohio-anchor-onepage')) { 5312 $('body #masthead a:not(.hamburger-holder):not(.search-global )').on('click', function (event) { 5313 5314 if ($(this).attr('href').includes('#')) { 5315 event.preventDefault(); 5316 var href = '#' + $(this).attr('href').split('#')[1]; 5317 5318 if ($(href).length) { 5319 $('html, body').animate({ 5320 scrollTop: $(href).offset().top 5321 }, 500, function () { 5322 window.location.hash = href; 5323 }); 5324 } 5325 5326 return false; 5327 } 5328 }); 5329 5330 if (window.location.hash.substring(0, 1) == '#') { 5331 if ($(window.location.hash).length) { 5332 $('html, body').animate({ 5333 scrollTop: $(window.location.hash).offset().top 5334 }, 500); 5335 } 5336 } 5337 } 5338 5339 /* Breadcrumbs filters handler */ 5340 $('.filter .select-inline select').change(function () { 5341 let $selected = $(this).find('option:selected'); 5342 if ($selected.attr('data-select-href')) { 5343 window.location.assign($selected.attr('data-select-href')); 5344 } 5345 }); 5346 5347})(jQuery); 5348 5349// Hack for elementor parallax fix 5350jQuery(window).on('load', function () { 5351 if (jQuery('.elementor-motion-effects-container').length) { 5352 setTimeout(function () { 5353 window.dispatchEvent(new Event('resize')); 5354 }, 500); 5355 } 5356}); 5357 5358// Elementor 5359jQuery(window).on('elementor/frontend/init', function () { 5360 jQuery(window).trigger('ohio:handle_global_page_animation'); 5361});
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.