1jQuery(function ($) { 2 $(".slider-items").slick({ 3 infinite: false, 4 slidesToShow: 1, 5 slidesToScroll: 1, 6 dots: true, 7 arrows: false, 8 adaptiveHeight: true 9 }); 10 11 // $(".single-product-images").slick({ 12 // infinite: false, 13 // slidesToShow: 1, 14 // slidesToScroll: 1, 15 // arrows: true, 16 // nextArrow: '<i class="fa fa-arrow-right"></i>', 17 // prevArrow: '<i class="fa fa-arrow-left"></i>', 18 // responsive: [ 19 // { 20 // breakpoint: 1025, 21 // settings: { 22 // adaptiveHeight: true 23 // } 24 // } 25 // ] 26 // }); 27 28 29 30 $(window).on("resize load", function () { 31 var heights = { 32 full: {} 33 }; 34 35 $("[data-equal]").css("height", "auto"); 36 $("[class*='data-equal-']").css("height", "auto"); 37 38 $("[data-equal], [class*='data-equal-']").each(function () { 39 var data_type = $(this).is("[class*='data-equal-']") ? "class" : "data"; 40 41 if (data_type == "data") { 42 var $elem = $(this).attr("data-equal"); 43 var size = $(this).attr("data-equal-width"); 44 } else { 45 var classes = this.className.split(/\s+/); 46 47 for (var i = 0; i < classes.length; i++) { 48 var class_name = classes[i]; 49 50 if (class_name.indexOf("data-equal-") > -1) { 51 $elem = class_name.replace("data-equal-", ""); 52 } 53 if (class_name.indexOf("data-equal-width-") > -1) { 54 size = class_name.replace("data-equal-width-", ""); 55 } 56 } 57 } 58 59 if (size == undefined) size = "full"; 60 61 if (heights[size] == undefined) { 62 heights[size] = {}; 63 } 64 65 if (heights[size][$elem] == undefined) { 66 heights[size][$elem] = 0; 67 } 68 69 var this_height = jQuery(this).outerHeight(); 70 71 if (this_height > heights[size][$elem]) { 72 heights[size][$elem] = this_height; 73 } 74 }); 75 76 var $window_width = $(window).outerWidth(); 77 78 for (var breakpoint in heights) { 79 var element_data_value = heights[breakpoint]; 80 81 for (var element in element_data_value) { 82 if ($window_width > parseInt(breakpoint) || breakpoint == "full") { 83 $( 84 "[data-equal='" + 85 element + 86 "'], [class*='data-equal-" + 87 element + 88 "']" 89 ).css("height", element_data_value[element]); 90 } 91 } 92 } 93 }); 94 95 var Grizzly = { 96 dom: { 97 body: $("body"), 98 window: $(window), 99 custom_video_trigger: $(".custom-video"), 100 custom_video_close: $(".featherlight-custom .featherlight-close"), 101 custom_video_wrapper: $(".featherlight-custom"), 102 lf_popup_content: $(".lf-popup-content"), 103 newsLoad: $(".load-more-news"), 104 product_slider: $(".slider-section-inner"), 105 svg_logo_header: $('.site-branding-main-logo, img[src$=".svg"]'), 106 product_title: $(".product-type-size-title"), 107 languageSwitcherToggle: $(".selected-language"), 108 inner_sub_menu: $(".inner-sub-menu"), 109 accordion_item: $(".accordion-item-title"), 110 home_header: $("body.home .site-header"), 111 nonClickableItems: $(".menu-item a[href='#']"), 112 polvere: $(".polvere"), 113 openCatalogPopup: $('.open-catalog-popup'), 114 catalogPopup: $('.catalog-popup-wrapper'), 115 catalogPopupUrlInput: $('.catalog-popup-url-input input'), 116 closePopupBtn: $('.catalog-popup-close i'), 117 product_types_item: $('.product-types-item'), 118 latest_news_items: $('.latest-news-items'), 119 usage_gallery_items: $('.usage-gallery-items, .single-product-usage-gallery'), 120 header: $('.site-header'), 121 request_link: $('.request-appointment-link a'), 122 hamburger: $('.hamburger'), 123 main_navigation: $('.main-navigation'), 124 main_sub_menu: $('.main-sub-menu, .product-sub-menu') 125 }, 126 vars: { 127 heroAnimationCompleted: false, 128 isHome: $("body").hasClass('home'), 129 scrollPosition: $('html, body').scrollTop(), 130 animationInProgress: false, 131 transitionTime: 1000, 132 }, 133 134 productImageSlider: function(){ 135 $(".single-product-images").slick({ 136 slidesToShow: 1, 137 slidesToScroll: 1, 138 dots: false, 139 mobileFirst: true, 140 infinite: false, 141 adaptiveHeight: true, 142 arrows: true, 143 nextArrow: '<i class="fa fa-arrow-right"></i>', 144 prevArrow: '<i class="fa fa-arrow-left"></i>', 145 responsive: [ 146 { 147 breakpoint: 1025, 148 settings: 'unslick' 149 }, 150 151 ] 152 }); 153 }, 154 155 // isInViewport: function(){ 156 157 // var elementTop = $(this).offset().top; var elementBottom = elementTop + $(this).outerHeight(); 158 // var viewportTop = $(window).scrollTop(); var viewportBottom = viewportTop + $(window).height(); 159 // return elementBottom > viewportTop && elementTop < viewportBottom; 160 161 // }, 162 163 fixedSection: function(){ 164 $(window).on("scroll resize load", function() { 165 166 var items = $(".single-product-top-white_"); 167 var inViewPortProduct = undefined; 168 var inViewPortIndex; 169 if ($(window).width() > 1024) { 170 $.each(items, function(index, elem) { 171 if($(elem).isInViewport()) { 172 inViewPortProduct = elem; 173 inViewPortIndex = index; 174 return false; 175 } 176 inViewPortProduct = undefined; 177 178 }) 179 if(inViewPortProduct) { 180 var bottom = $(".single-product-item-bottom")[inViewPortIndex];
181 var rect = inViewPortProduct.getBoundingClientRect(); 182 $(inViewPortProduct).css("left", rect.left); 183 $(inViewPortProduct).css("right", rect.right); 184 $(inViewPortProduct).stickOnScroll({ 185 topOffset: 200, 186 footerElement: $(bottom), 187 }); 188 } 189 } 190 191 }) 192 193 }, 194 195 subMenuToggleOnMobile: function(){ 196 197 198 if ($(window).width() < 1025) { 199 Grizzly.dom.main_sub_menu.on("click", function(){ 200 if(! $(this).hasClass("expandeds")){ 201 $(this).addClass("expandeds"); 202 $(this).children(".sub-menu").slideDown(); 203 } else{ 204 $(this).removeClass("expandeds"); 205 $(this).children(".sub-menu").slideUp(); 206 } 207 208 }) 209 } 210 211 }, 212 213 showInnerSubmenu: function(){ 214 $( ".site-header li.inner-sub-menu.menu-item-has-children").each(function(){ 215 if( $(this).find('.arrow-toggle-inner').length > 0 ) return; 216 var $parent = this; 217 var $arrow = $("<span class='arrow-toggle-inner'><i class='fas fa-caret-down' aria-hidden='true'></i></span>"); 218 $(this).prepend($arrow); 219 $arrow.on('click', function(e){ 220 e.stopPropagation(); 221 $(this).toggleClass("opened-submenu"); 222 $( $parent ).find('> .sub-menu').slideToggle(500); 223 }); 224 225 }); 226 227 }, 228 229 toggleCaret: function(){ 230 $('.toggleCaret').on('click', function(){ 231 $(this).toggleClass("expanded"); 232 $(this).parents(".single-product-top-grey").find(".features-wrapper").slideToggle().toggleClass("content-shown"); 233 }) 234 }, 235 236 toggleInfo: function(){ 237 $('.toggleInfo').on('click', function(){ 238 $(this).toggleClass("not-expanded"); 239 $(this).parents(".single-product-top-white").find(".description-wrapper").slideToggle(); 240 }) 241 }, 242 243 menuItemDecoration: function(){ 244 var menu = $(".menu-main-menu-container"); 245 var indicator = $('<span class="indicator"></span>'); 246 247 menu.append(indicator); 248 position_indicator( 249 menu.find( 250 "li.main-item.current-menu-item, li.main-item.current-menu-parent, li.current-menu-ancestor" 251 ) 252 ); 253 254 $(window).on("resize", function () { 255 position_indicator( 256 menu.find( 257 "li.main-item" 258 ) 259 ); 260 }); 261 262 setTimeout(function () { 263 indicator.css("opacity", 1); 264 }, 500); 265 266 menu.find("li.main-item").mouseenter(function () { 267 position_indicator($(this)); 268 }); 269 menu.find("li.main-item").mouseleave(function(){ 270 position_indicator(menu.find("li.main-item.current-menu-item, li.main-item.current-menu-parent, li.current-menu-ancestor")); 271 }); 272 273 function position_indicator(ele) { 274 if (!ele.length){ 275 indicator.stop().animate({ 276 opacity: 0 277 }); 278 279 return; 280 } 281 282 var left = ele.offset().left + 20; 283 var width = ele.width(); 284 indicator.stop().animate({ 285 opacity: 1, 286 left: left, 287 width: width 288 }); 289 } 290 }, 291 292 mobileOnlySlider: function() { 293 Grizzly.dom.latest_news_items.slick({ 294 slidesToShow: 1, 295 slidesToScroll: 1, 296 arrows: true, 297 nextArrow: '<i class="fa fa-arrow-right"></i>', 298 prevArrow: '<i class="fa fa-arrow-left"></i>', 299 mobileFirst: true, 300 infinite: false, 301 responsive: [ 302 { 303 breakpoint: 768, 304 settings: 'unslick' 305 } 306 ] 307 }); 308 }, 309 310 galleryMobileSlider: function(){ 311 Grizzly.dom.usage_gallery_items.slick({ 312 slidesToShow: 1, 313 slidesToScroll: 1, 314 arrows: true, 315 nextArrow: '<i class="fa fa-arrow-right"></i>', 316 prevArrow: '<i class="fa fa-arrow-left"></i>', 317 mobileFirst: true, 318 infinite: false, 319 responsive: [ 320 { 321 breakpoint: 769, 322 settings: 'unslick' 323 } 324 ] 325 }); 326 }, 327 328 toggleHoveredClass: function(){ 329 Grizzly.dom.product_types_item.on('mouseenter', function(){ 330 $(this).addClass("hovered"); 331 $(this).find(".product-types-item-link").addClass("button-hovered"); 332 }) 333 Grizzly.dom.product_types_item.on('mouseleave', function(){ 334 $(this).removeClass("hovered"); 335 $(this).find(".product-types-item-link").removeClass("button-hovered"); 336 }) 337 }, 338 339 cleanTheDust: function(e) { 340 341 //if( Grizzly.vars.animationInProgress ) { 342 // window.scrollTo(0, 0); 343 // e.preventDefault(); 344 //} 345 346 //if( Grizzly.vars.isHome && Grizzly.vars.scrollPosition == 0 && !Grizzly.vars.heroAnimationCompleted ){ 347 348 349 //window.scrollTo(0, 0); 350 351 Grizzly.dom.polvere.addClass('vacuum-the-dust'); 352 353 /*setTimeout(function(){ 354 Grizzly.vars.animationInProgress = false;
355 Grizzly.vars.heroAnimationCompleted = true; 356 }, Grizzly.vars.transitionTime);*/ 357 358 //e.preventDefault(); 359 360 return false; 361 //} 362 363 364 }, 365 366 catalogPopup: function() { 367 Grizzly.dom.openCatalogPopup.on("click", function(e) { 368 $("body").addClass("form-shown"); 369 Grizzly.dom.catalogPopup.addClass("popup-shown"); 370 var catalogUrl = $(this).attr('data-catalog-url'); 371 Grizzly.dom.catalogPopupUrlInput.val(catalogUrl); 372 }); 373 Grizzly.dom.closePopupBtn.on("click", function(e) { 374 $("body").removeClass("form-shown"); 375 Grizzly.dom.catalogPopup.removeClass("popup-shown"); 376 }) 377 }, 378 379 smoothScroll: function () { 380 $('a[href*="#"]:not([href="#"])').click(function (event) { 381 var header_height = Grizzly.dom.header.outerHeight(); 382 Grizzly.dom.body.removeClass("menu-active"); 383 Grizzly.dom.main_navigation.removeClass("toggled"); 384 Grizzly.dom.hamburger.removeClass("is-active"); 385 if ( 386 location.pathname.replace(/^\//, "") == 387 this.pathname.replace(/^\//, "") && 388 location.hostname == this.hostname 389 ) { 390 var target = $(this.hash); 391 target = target.length 392 ? target 393 : $("[name=" + this.hash.slice(1) + "]"); 394 395 if (target.length) { 396 event.preventDefault(); 397 $("html, body").animate( 398 { 399 scrollTop: target.offset().top - header_height - 50 400 }, 401 800 402 403 ); 404 } 405 } 406 }); 407 }, 408 409 410 411 changeHeaderBackground: function () { 412 $(window).on("scroll", function () { 413 Grizzly.vars.scrollPosition = $('html, body').scrollTop(); 414 415 if ($(window).scrollTop() > 50) { 416 Grizzly.dom.home_header.addClass("white-header"); 417 } else { 418 Grizzly.dom.home_header.removeClass("white-header"); 419 } 420 }); 421 }, 422
423 showDetails: function () { 424 Grizzly.dom.product_title.on("mouseenter", function () { 425 $(this) 426 .next() 427 .addClass("shown"); 428 }); 429 Grizzly.dom.product_title.on("mouseleave", function () { 430 $(this) 431 .next() 432 .removeClass("shown"); 433 }); 434 }, 435 436 languageSwitcherToggleSlide: function () { 437 Grizzly.dom.languageSwitcherToggle.click(function () { 438 $(this) 439 .parent(".language-switcher-wrap") 440 .find(".custom-language-switcher") 441 .slideToggle("slow"); 442 }); 443 }, 444 445 toggleAccordion: function () { 446 Grizzly.dom.accordion_item.on("click", function () { 447 var header_height = Grizzly.dom.header.outerHeight(); 448 $(this).parent().children('.accordion-item-text-wrapper').slideToggle(); 449 $(this).parent().toggleClass('expanded'); 450 target = $(this); 451 $("html, body").animate( 452 { 453 scrollTop: target.offset().top - header_height - 50 454 }, 455 800 456 ); 457 }); 458 }, 459 460 461 convertLogoToSvg: function () { 462 Grizzly.dom.svg_logo_header.each(function () { 463 var $img = jQuery(this); 464 var imgURL = $img.attr("src"); 465 var attributes = $img.prop("attributes"); 466 467 $.get( 468 imgURL, 469 function (data) { 470 // Get the SVG tag, ignore the rest 471 var $svg = jQuery(data).find("svg"); 472 473 // Remove any invalid XML tags 474 $svg = $svg.removeAttr("xmlns:a"); 475 476 // Loop through IMG attributes and apply on SVG 477 $.each(attributes, function () { 478 $svg.attr(this.name, this.value); 479 }); 480 481 // Replace IMG with SVG 482 $img.replaceWith($svg); 483 484 var svg_id = $svg.attr("id"); 485 }, 486 "xml" 487 ); 488 }); 489 }, 490 491 // Custom Video 492 triggerOpenCustomVideo: function () { 493 $(document).keyup(function (e) { 494 if (e.keyCode === 27) { 495 Grizzly.closeCustomPopup(e); 496 } 497 }); 498 499 Grizzly.dom.custom_video_wrapper.on("click", function (e) { 500 e.preventDefault(); 501 502 if ($(e.target).hasClass("featherlight-custom")) { 503 Grizzly.closeCustomPopup(e); 504 } 505 }); 506 Grizzly.dom.custom_video_trigger.on("click", function (e) { 507 Grizzly.dom.body.addClass("video-opened"); 508 e.preventDefault(); 509 510 var video_id = $(this).attr("href"); 511 var referent_container = $(video_id).find(".mejs-container"); 512 var player = mejs.players[$(referent_container).attr("id")]; 513 514 $(video_id) 515 .parents(".featherlight-custom") 516 .fadeIn(0); 517 518 player.setPlayerSize(1200, 800); 519 player.load(); 520 521 player.play(); 522 }); 523 524 Grizzly.dom.custom_video_close.on("click", function (e) { 525 Grizzly.closeCustomPopup(e); 526 }); 527 }, 528 closeCustomPopup: function (e) { 529 e.preventDefault(); 530 Grizzly.dom.body.removeClass("video-opened"); 531 532 $(".featherlight-custom").fadeOut(500); 533 534 var elements = $(".wp-video > div, .video-player object"); 535 536 elements.each(function (i, player_html) { 537 var player = mejs.players[player_html.id]; 538 539 if (!player.paused) { 540 player.pause(); 541 } 542 }); 543 }, 544 545 footerMobileMenu: function () { 546 var windowWidth = $(window).width(); 547 var $footerMenuButton = $(".footer-column-3"); 548 var $content = $(".widget_nav_menu"); 549 var $chevron = $footerMenuButton.find("[class*='fa-chevron']"); 550 if (windowWidth <= 767) { 551 if ($chevron.length === 0) { 552 $footerMenuButton.append('<i class="fas fa-arrow-down"></i>'); 553 $content.hide(); 554 $footerMenuButton.on("click", function() { 555 $(this).find('i').toggleClass('fa-arrow-up').toggleClass('fa-arrow-down'); 556 $(this).children("aside").slideToggle(); 557 }) 558 } 559 } else { 560 $content.show(); 561 } 562 }, 563 564 blogAsideToggle: function(){ 565 var windowWidth = $(window).width(); 566 var $asideButton = $("#secondary .widget-title"); 567 var $content = $("#secondary ul"); 568 var $chevron = $asideButton.find("[class*='fa-chevron']"); 569 if (windowWidth <= 991) { 570 if ($chevron.length === 0) { 571 $asideButton.append('<i class="fas fa-arrow-down"></i>'); 572 $content.hide(); 573 $asideButton.on("click", function() { 574 $(this).find('i').toggleClass('fa-arrow-up').toggleClass('fa-arrow-down'); 575 $(this).next("ul").slideToggle(); 576 }) 577 } 578 } else { 579 $content.show(); 580 } 581 }, 582 583 // Load More 584 loadMoreFunction: function () { 585 Grizzly.dom.newsLoad.on("click", function (e) { 586 _this = $(this); 587 var _showed = _this.data("showed"); 588 var _all = _this.data("all"); 589 var _pageType = _this.data("page-type"); 590 var _thisFilter = _this.data("this-filter"); 591 _this.addClass("loading"); 592 593 $.ajax({ 594 url: js_vars.ajaxurl, 595 type: "POST", 596 dataType: "HTML", 597 data: { 598 action: "load_more_news", 599 showed: _showed, 600 pageType: _pageType, 601 thisFilter: _thisFilter 602 }, 603 beforeSend: function () { 604 Grizzly.dom.body.addClass("loading"); 605 }, 606 success: function (data) { 607 _this.before(data); 608 _this.removeClass("loading"); 609 _this.data("showed", _showed + 6); 610 611 if (_showed + 6 >= _all) { 612 _this.fadeOut(); 613 } 614 615 Grizzly.dom.body.removeClass("loading"); 616 } 617 }); 618 }); 619 }, 620 // wowInit: function () { 621 // new WOW().init(); 622 // }, 623 624 bindEvents: function () { 625 this.dom.nonClickableItems.on("click", function (e) { 626 e.preventDefault(); 627 }); 628 629 window.addEventListener('keydown', function(event){ 630 if (!event) 631 event = window.event; 632 633 var code = event.keyCode; 634 if (event.charCode && code == 0) 635 code = event.charCode; 636 switch(code) { 637 case 37: 638 // Key left. 639 break; 640 case 38: 641 // Key up. 642 Grizzly.cleanTheDust(event); 643 break; 644 case 39: 645 // Key right. 646 break; 647 case 40: 648 // Key down. 649 Grizzly.cleanTheDust(event); 650 break; 651 } 652 653 }, {passive: false}) 654 window.addEventListener('DOMMouseScroll', Grizzly.cleanTheDust, {passive: false}); 655 window.addEventListener('touchmove', Grizzly.cleanTheDust, { passive: false }); 656 window.addEventListener('mousewheel', Grizzly.cleanTheDust, { passive: false }); 657 document.addEventListener('mousewheel', Grizzly.cleanTheDust, { passive: false }); 658 window.addEventListener('wheel', Grizzly.cleanTheDust, { passive: false }); 659 }, 660 661 disableScroll: function() { 662 663 if (window.addEventListener) { 664 window.addEventListener('DOMMouseScroll', Grizzly.preventDefault, {passive: false}); 665 } 666 667 document.addEventListener('wheel', Grizzly.preventDefault, {passive: false}); // Disable scrolling in Chrome 668 document.onkeydown = Grizzly.preventDefaultForScrollKeys; 669 670 window.addEventListener('touchmove', Grizzly.preventDefault, { passive: false }); 671 window.addEventListener('mousewheel', Grizzly.preventDefault, { passive: false }); 672 document.addEventListener('mousewheel', Grizzly.preventDefault, { passive: false }); 673 window.addEventListener('wheel', Grizzly.preventDefault, { passive: false }); 674 675 }, 676 677 enableScroll: function() { 678 if (window.removeEventListener) { 679 window.removeEventListener('DOMMouseScroll', Grizzly.preventDefault, {passive: false}); 680 } 681 682 document.removeEventListener('wheel', Grizzly.preventDefault, {passive: false}); // Enable scrolling in Chrome 683 684 window.removeEventListener('touchmove', Grizzly.preventDefault, { passive: false }); 685 window.removeEventListener('mousewheel', Grizzly.preventDefault, { passive: false }); 686 document.removeEventListener('mousewheel', Grizzly.preventDefault, { passive: false }); 687 window.removeEventListener('wheel', Grizzly.preventDefault, { passive: false }); 688 689 }, 690 691 preventDefault: function(e) { 692 e = e || window.event; 693 if (e.preventDefault) 694 e.preventDefault(); 695 e.returnValue = false; 696 }, 697 698 jobApply: function(e) { 699 $('.accordion-link-wrapper').on("click", function (e) { 700 var jobTitleEl = $(this).parent().siblings('.accordion-item-title'); 701 var jobTitle = jobTitleEl.children('.accordion-item-title-item').text(); 702 $('.resume-position-input input').val(jobTitle); 703 }); 704 }, 705 706 init: function () { 707 // if( this.dom.body.hasClass('home') && $(window).scrollTop() == 0 ){ 708 // this.disableScroll(); 709 // } 710 this.triggerOpenCustomVideo(); 711 this.loadMoreFunction(); 712 this.convertLogoToSvg();
713 this.showDetails(); 714 // this.wowInit(); 715 this.languageSwitcherToggleSlide(); 716 this.toggleAccordion(); 717 this.smoothScroll(); 718 this.changeHeaderBackground(); 719 this.bindEvents(); 720 this.catalogPopup(); 721 this.jobApply(); 722 this.toggleHoveredClass(); 723 this.menuItemDecoration(); 724 this.footerMobileMenu(); 725 this.blogAsideToggle(); 726 this.mobileOnlySlider(); 727 this.galleryMobileSlider(); 728 this.subMenuToggleOnMobile(); 729 this.showInnerSubmenu(); 730 this.fixedSection(); 731 this.toggleCaret(); 732 this.toggleInfo(); 733 this.productImageSlider(); 734 } 735 }; 736 737 // Initialize our main script 738 Grizzly.init(); 739 740 $.fn.isInViewport = function() { 741 var elementTop = $(this).offset().top; var elementBottom = elementTop + $(this).outerHeight(); 742 var viewportTop = $(window).scrollTop(); var viewportBottom = viewportTop + $(window).height(); 743 return elementBottom > viewportTop && elementTop < viewportBottom; 744 }; 745}) 746 747 748//fadeout loader 749jQuery(window).on("load", function () { 750 jQuery(".page-loader-wrapper").fadeOut("slow", function () { 751 jQuery("body").addClass("page-loaded"); 752 }); 753 jQuery("body").css("overflow-y", "visible"); 754}); 755 756 757 758 759 760/** 761 * navigation.js 762 * 763 * Handles toggling the navigation menu for small screens and enables tab 764 * support for dropdown menus. 765 */ 766( function($) { 767 var container, button, menu, links, subMenus; 768 769 container = document.getElementById( 'site-navigation' ); 770 if ( ! container ) { 771 return; 772 } 773 774 button = container.getElementsByTagName( 'button' )[0]; 775 if ( 'undefined' === typeof button ) { 776 return; 777 } 778 779 menu = container.getElementsByTagName( 'ul' )[0]; 780 781 // Hide menu toggle button if menu is empty and return early. 782 if ( 'undefined' === typeof menu ) { 783 button.style.display = 'none'; 784 return; 785 } 786 787 menu.setAttribute( 'aria-expanded', 'false' ); 788 if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { 789 menu.className += ' nav-menu'; 790 } 791 792 button.onclick = function() { 793 if ( -1 !== container.className.indexOf( 'toggled' ) ) { 794 container.className = container.className.replace( ' toggled', '' ); 795 button.setAttribute( 'aria-expanded', 'false' ); 796 menu.setAttribute( 'aria-expanded', 'false' ); 797 } else { 798 container.className += ' toggled'; 799 button.setAttribute( 'aria-expanded', 'true' ); 800 menu.setAttribute( 'aria-expanded', 'true' ); 801 } 802 }; 803 804 // Get all the link elements within the menu. 805 links = menu.getElementsByTagName( 'a' ); 806 subMenus = menu.getElementsByTagName( 'ul' ); 807 808 // Set menu items with submenus to aria-haspopup="true". 809 for ( var i = 0, len = subMenus.length; i < len; i++ ) { 810 subMenus[i].parentNode.setAttribute( 'aria-haspopup', 'true' ); 811 } 812 813 // Each time a menu link is focused or blurred, toggle focus. 814 for ( i = 0, len = links.length; i < len; i++ ) { 815 links[i].addEventListener( 'focus', toggleFocus, true ); 816 links[i].addEventListener( 'blur', toggleFocus, true ); 817 } 818 819 /** 820 * Sets or removes .focus class on an element. 821 */ 822 function toggleFocus() { 823 var self = this; 824 825 // Move up through the ancestors of the current link until we hit .nav-menu. 826 while ( -1 === self.className.indexOf( 'nav-menu' ) ) { 827 828 // On li elements toggle the class .focus. 829 if ( 'li' === self.tagName.toLowerCase() ) { 830 if ( -1 !== self.className.indexOf( 'focus' ) ) { 831 self.className = self.className.replace( ' focus', '' ); 832 } else { 833 self.className += ' focus'; 834 } 835 } 836 837 self = self.parentElement; 838 } 839 } 840 841 842 843 $( ".main-navigation .nav-menu > li.menu-item-has-children").each(function(){ 844 var parent = this; 845 var arrow = $("<span class='arrow-toggle'><i class='fas fa-caret-down' aria-hidden='true'></i></span>"); 846 $( parent ).prepend( arrow ); 847 }); 848 var nav = $('.menu-item-has-children ul'), 849 animateTime = 750, 850 navLink = $('.arrow-toggle'); 851 navLink.click(function(){ 852 if(nav.height() === 0){ 853 autoHeightAnimate(nav, animateTime); 854 } else { 855 nav.stop().animate({ height: '0' }, animateTime); 856 } 857 }); 858 859 /* Function to animate height: auto */ 860 function autoHeightAnimate(element, time){ 861 var curHeight = element.height(), // Get Default Height 862 autoHeight = element.css('height', 'auto').height(); // Get Auto Height 863 element.height(curHeight); // Reset to Default Height 864 element.stop().animate({ height: autoHeight }, parseInt(time)); // Animate to Auto Height 865 } 866 867 /*Responsive navigation sub-menu handle*/ 868 var _window; 869 870 _window = { 871 is_mobile: false, 872 is_tablet: false, 873 width: $(window).outerWidth(), 874 height: $(window).outerHeight(), 875 is_portable: function(){ 876 if( this.width <= 1024 && this.width >= 768 ){ 877 this.is_tablet = true; 878 this.is_mobile = false;
879 } 880 else if( this.width >= 1024 ){ 881 this.is_tablet = false; 882 this.is_mobile = false; 883 } 884 else if( this.width < 768 ){ 885 this.is_tablet = false; 886 this.is_mobile = true; 887 } 888 } 889 }; 890 891 $(window).on('resize load', function(){ 892 _window.width = $(window).outerWidth(); 893 _window.height = $(window).outerHeight(); 894 _window.is_portable(); 895 896 /* Menu tablet & mobile */ 897 if( _window.is_tablet || _window.is_mobile){ 898 899 $( ".site-header li.main-item.menu-item-has-children").each(function(){ 900 901 if( $(this).find('.arrow-toggle').length > 0 ) return; 902 903 var $parent = this; 904 905 var $arrow = $("<span class='arrow-toggle'><i class='fas fa-caret-down' aria-hidden='true'></i></span>"); 906 907 $(this).prepend( $arrow ); 908 909 $arrow.on('click', function(e){ 910 e.stopPropagation(); 911 $( $parent ).toggleClass( "expandeds" ); 912 $( $parent ).find('> .sub-menu').slideToggle(500); 913 $(".merge-navigation-wrapper").css('height', $(window).height()); 914 }); 915 916 }); 917 918 919 } else { 920 921 $('.arrow-toggle').remove(); 922 923 } 924 925 }); 926 927 928} )(jQuery); 929 930 931 932// jQuery( document ).ready(function($) { 933// 934// $('.slick-slider-init').on( 'init', function(){ 935// $(".slick-prev-lf").insertBefore( $('.slick-dots') ); 936// $(".slick-next-lf").insertAfter( $('.slick-dots') ); 937// $(".gallery-wrapper").animate({ 938// opacity: 1 939// }); 940// }); 941// $('.slick-slider-init-2').on( 'init', function(){ 942// $(".gallery-wrapper").animate({ 943// opacity: 1 944// }); 945// }); 946// 947// $('.slick-slider-init').slick({ 948// infinite: true, 949// slidesToShow: 1, 950// slidesToScroll: 1, 951// dots: true, 952// adaptiveHeight: true, 953// prevArrow: "<span class='slick-prev-lf'><i class='fa fa-angle-left' aria-hidden='true'></i></span>", 954// nextArrow: "<span class='slick-next-lf'><i class='fa fa-angle-right' aria-hidden='true'></i></span>", 955// customPaging: function(slick,index) { 956// return '<a>' + (index + 1) + '</a>'; 957// } 958// }); 959// 960// $('.slick-slider-init-1').slick({ 961// infinite: true, 962// slidesToShow: 1, 963// slidesToScroll: 1, 964// dots: false, 965// fade: true, 966// arrows: false, 967// asNavFor: '.slick-slider-init-2', 968// adaptiveHeight: false 969// }); 970// $('.slick-slider-init-2').slick({ 971// infinite: true, 972// slidesToShow: 5, 973// slidesToScroll: 1, 974// dots: false, 975// adaptiveHeight: false, 976// asNavFor: '.slick-slider-init-1', 977// focusOnSelect: true, 978// centerMode: true, 979// prevArrow: "<span class='slick-prev-lf'><i class='fa fa-angle-left' aria-hidden='true'></i></span>", 980// nextArrow: "<span class='slick-next-lf'><i class='fa fa-angle-right' aria-hidden='true'></i></span>" 981// }); 982// 983// $('.slick-slider-init-3').slick({ 984// infinite: true, 985// slidesToShow: 1, 986// slidesToScroll: 1, 987// dots: true, 988// adaptiveHeight: true, 989// prevArrow: "<span class='slick-prev-lf'><i class='fa fa-angle-left' aria-hidden='true'></i></span>", 990// nextArrow: "<span class='slick-next-lf'><i class='fa fa-angle-right' aria-hidden='true'></i></span>" 991// }); 992// 993// }); 994 995/** 996 * jquery.stickOnScroll.js 997 * A jQuery plugin for making element fixed on the page. 998 * 999 * Created by Paul Tavares on 2012-10-19. 1000 * Copyright 2012 Paul Tavares. All rights reserved. 1001 * Licensed under the terms of the MIT License 1002 * 1003 */ 1004 1005;(function(factory) { 1006 if (typeof define === 'function' && define.amd) { 1007 define(['jquery'], factory); 1008 } else { 1009 factory(jQuery); 1010 } 1011}(function($){ 1012 1013 "use strict"; 1014 /*jslint plusplus: true */ 1015 /*global $,jQuery */ 1016 1017 var 1018 // Check if we're working in IE. Will control the animation 1019 // on the fixed elements. 1020 isIE = ($.support.optSelected === false ? true : false), 1021 1022 // List of viewports and associated array of bound sticky elements 1023 viewports = {}, 1024 1025 // Local variable to hold methods 1026 fn = {}; 1027 1028 /**
1029 * Function bound to viewport's scroll event. Loops through 1030 * the list of elements that needs to be sticked for the 1031 * given viewport. 1032 * "this" keyword is assumed to be the viewport. 1033 * 1034 * @param {eventObject} jQuery's event object. 1035 * 1036 * @return {Object} The viewport (this keyword) 1037 * 1038 */ 1039 function processElements(ev) { 1040 1041 var elements = viewports[$(this).prop("stickOnScroll")], 1042 i,j; 1043 1044 // Loop through all elements bound to this viewport. 1045 for( i=0,j=elements.length; i<j; i++ ){ 1046 1047 // Scope in the variables 1048 // We call this anonymous funnction with the 1049 // current array element ( elements[i] ) 1050 (function(o){ 1051 1052 var scrollTop, 1053 maxTop, 1054 cssPosition, 1055 footerTop, 1056 eleHeight, 1057 yAxis; 1058 1059 // get this viewport options 1060 o = elements[i]; 1061 1062 // FIXME: Should the clean up of reference to removed element store the position in the array and delete it later? 1063 1064 // If element has no parent, then it must have been removed from DOM... 1065 // Remove reference to it 1066 if (o !== null) { 1067 1068 // jquery contains works on dom object; not jquery selections 1069 if (!$.contains(document.documentElement, o.ele[0])) { 1070 1071 elements[i] = o = null; 1072 1073 } 1074 1075 } 1076 if (o !== null) { 1077 1078 // Get the scroll top position on the view port 1079 scrollTop = o.viewport.scrollTop(); 1080 1081 // set the maxTop before we stick the element 1082 // to be it's "normal" topPosition minus offset 1083 maxTop = o.getEleMaxTop(); 1084 1085 // TODO: What about calculating top values with margin's set? 1086 // pt.params.footer.css('marginTop').replace(/auto/, 0) 1087 1088 // If not using the window object, then stop any IE animation 1089 if (o.isWindow === false && isIE) { 1090 o.ele.stop(); 1091 } 1092 1093 // If the current scrollTop position is greater 1094 // than our maxTop value, then make element stick on the page. 1095 if (scrollTop >= maxTop){ 1096 1097 cssPosition = { 1098 position: "fixed", 1099 top: ( o.topOffset - o.eleTopMargin ) 1100 }; 1101 1102 if (o.isWindow === false) { 1103 1104 cssPosition = { 1105 position: "absolute", 1106 top: ( ( scrollTop + o.topOffset ) - o.eleTopMargin ) 1107 }; 1108 1109 } 1110 1111 o.isStick = true; 1112 1113 // ---> HAS FOOTER ELEMENT? 1114 // check to see if it we're reaching the footer element, 1115 // and if so, scroll the item up with the page 1116 if (o.footerElement.length) { 1117 1118 // Calculate the distance from the *bottom* of the fixed 1119 // element to the footer element, taking into consideration 1120 // the bottomOffset that may have been set by the user. 1121 footerTop = o.getEleTopPosition(o.footerElement); 1122 eleHeight = o.ele.outerHeight(); 1123 yAxis = ( cssPosition.top + eleHeight + 1124 o.bottomOffset + o.topOffset ); 1125 1126 if (o.isWindow === false) { 1127 1128 yAxis = (eleHeight + o.bottomOffset + o.topOffset); 1129 1130 } else { 1131 1132 yAxis = ( cssPosition.top + scrollTop + 1133 eleHeight + o.bottomOffset ); 1134 1135 footerTop = o.getElementDistanceFromViewport(o.footerElement); 1136 1137 } 1138 1139 // If the footer element is overstopping the sticky element 1140 // position, then adjust it so that we make room for the 1141 // fotoer element. 1142 if (yAxis > footerTop) { 1143 1144 if (o.isWindow === true) { 1145 1146 cssPosition.top = ( 1147 footerTop - ( scrollTop + eleHeight + o.bottomOffset ) 1148 ); 1149 1150 // Absolute positioned element 1151 } else { 1152 1153 cssPosition.top = (scrollTop - (yAxis - footerTop)); 1154 1155 } 1156 1157 } 1158 1159 } 1160 1161 // If o.setParentOnStick is true, then set the 1162 // height to this node's parent. 1163 if (o.setParentOnStick === true) { 1164 1165 o.eleParent.css("height", o.eleParent.height()); 1166 1167 } 1168 1169 // If o.setWidthOnStick is true, then set the width on the 1170 // element that is about to be Sticky. 1171 if (o.setWidthOnStick === true) { 1172 1173 o.ele.css("width", o.ele.css("width")); 1174 1175 } 1176 1177 // If we have additional stick offset, apply it now 1178 if (!o.isViewportOffsetParent) { 1179 1180 cssPosition.top = ( 1181 cssPosition.top - o.getElementDistanceFromViewport(o.eleOffsetParent) 1182 ); 1183 1184 } 1185 1186 // Stick the element 1187 if (isIE && o.isWindow === false) { 1188 1189 o.ele 1190 .addClass(o.stickClass) 1191 .css("position", cssPosition.position) 1192 .animate({top: cssPosition.top}, 150); 1193 1194 } else { 1195 1196 o.ele 1197 .css(cssPosition) 1198 .addClass(o.stickClass); 1199 1200 } 1201 1202 // If making element stick now, then trigger 1203 // onStick callback if any 1204 if (o.wasStickCalled === false) { 1205 1206 o.wasStickCalled = true; 1207 1208 setTimeout(function(){ 1209 1210 if (o.isOnStickSet === true) { 1211 1212 o.onStick.call(o.ele, o.ele); 1213 1214 } 1215 1216 o.ele.trigger("stickOnScroll:onStick", [o.ele]); 1217 1218 }, 20); 1219 1220 } 1221 1222 // ELSE, If the scrollTop of the view port is 1223 // less than the maxTop, then throw the element back into the 1224 // page normal flow 1225 } else if (scrollTop <= maxTop) { 1226 1227 if (o.isStick) { 1228 1229 // reset element 1230 o.ele 1231 .css({ 1232 position: "", 1233 top: "" 1234 }) 1235 .removeClass(o.stickClass); 1236 1237 o.isStick = false;
1238 1239 // Reset parent if o.setParentOnStick is true 1240 if (o.setParentOnStick === true) { 1241 1242 o.eleParent.css("height", ""); 1243 1244 } 1245 1246 // Reset the element's width if o.setWidthOnStick is true 1247 if (o.setWidthOnStick === true) { 1248 1249 o.ele.css("width", ""); 1250 1251 } 1252 1253 o.wasStickCalled = false; 1254 1255 setTimeout(function(){ 1256 1257 // Execute the onUnStick if defined 1258 if (o.isOnUnStickSet) { 1259 1260 o.onUnStick.call( o.ele, o.ele ); 1261 1262 } 1263 1264 o.ele.trigger("stickOnScroll:onUnStick", [o.ele]); 1265 1266 }, 20); 1267 1268 } 1269 } 1270 1271 // Recalculate the original top position of the element... 1272 // this could have changed from when element was initialized 1273 // - ex. elements were inserted into DOM. We re-calculate only 1274 // if the we're at the very top of the viewport, so that we can 1275 // get a good position. 1276 if (scrollTop === 0) { 1277 1278 o.setEleTop(); 1279 1280 } 1281 1282 }// is element setup null? 1283 1284 })( elements[i] ); 1285 1286 }//end: for() 1287 1288 return this; 1289 1290 }//end: processElements() 1291 1292 1293 /** 1294 * Make the selected items stick to the top of the viewport 1295 * upon reaching a scrolling offset. 1296 * This method manipulates the following css properties on 1297 * the element that is to be sticky: top, position. 1298 * Elements also receive a css class named 'hasStickOnScroll'. 1299 * 1300 * @param {Object} options 1301 * @param {Integer} [options.topOffset=0] 1302 * @param {Integer} [options.bottomOffset=5] 1303 * @param {Object|HTMLElement|jQuery} [options.footerElement=null] 1304 * @param {Object|HTMLElement|jQuery} [options.viewport=window] 1305 * @param {String} [options.stickClass="stickOnScroll-on"] 1306 * @param {Boolean} [options.setParentOnStick=false] 1307 * @param {Boolean} [options.setWidthOnStick=false] 1308 * @param {Function} [options.onStick=null] 1309 * @param {Function} [options.onUnStick=null] 1310 * 1311 * @return {jQuery} this 1312 * 1313 */ 1314 $.fn.stickOnScroll = function(options) 1315 { 1316 return this.each(function(){ 1317 1318 // If element already has stickonscroll, exit. 1319 if ($(this).hasClass("hasStickOnScroll")) { 1320 return this; 1321 } 1322 1323 // Setup options for tis instance 1324 var o = $.extend({}, { 1325 topOffset: 0, 1326 bottomOffset: 5, 1327 footerElement: null, 1328 viewport: window, 1329 stickClass: 'stickOnScroll-on', 1330 setParentOnStick: false, 1331 setWidthOnStick: false, 1332 onStick: null, 1333 onUnStick: null 1334 }, options), 1335 viewportKey, 1336 setIntID, 1337 setIntTries = 1800; // 1800 tries * 100 milliseconds = 3 minutes 1338 1339 o.isStick = false; 1340 o.ele = $(this).addClass("hasStickOnScroll"); 1341 o.eleParent = o.ele.parent(); 1342 o.eleOffsetParent = o.ele.offsetParent(); 1343 o.viewport = $(o.viewport); 1344 o.eleTop = 0; 1345 o.eleTopMargin = parseFloat( 1346 (o.ele.css("margin-top") || 0) 1347 ) || 0; 1348 o.footerElement = $(o.footerElement); 1349 o.isWindow = true; 1350 o.isOnStickSet = $.isFunction(o.onStick); 1351 o.isOnUnStickSet = $.isFunction(o.onUnStick); 1352 o.wasStickCalled = false;
1353 o.isViewportOffsetParent = true; 1354 1355 /** 1356 * Retrieves the element's top position based on the type of viewport 1357 * and sets on the options object for the instance. This Top position 1358 * is the element top position relative to the the viewport. 1359 * 1360 * @return {Integer} 1361 */ 1362 o.setEleTop = function(){ 1363 1364 if (o.isStick === false) { 1365 1366 if (o.isWindow) { 1367 1368 o.eleTop = o.ele.offset().top; 1369 1370 } else { 1371 1372 o.eleTop = ( o.ele.offset().top - o.viewport.offset().top ); 1373 1374 } 1375 1376 } 1377 1378 }; //end: o.setEleTop() 1379 1380 /** 1381 * REturns an elements top position in relation 1382 * to the viewport's Top Position. 1383 * 1384 * @param {jQuery} $ele 1385 * This element must be inside the viewport 1386 * 1387 * @return {Integer} 1388 * 1389 */ 1390 o.getEleTopPosition = function($ele) { 1391 1392 var pos = 0; 1393 1394 if (o.isWindow) { 1395 1396 pos = $ele.offset().top; 1397 1398 } else { 1399 1400 pos = ( $ele.offset().top - o.viewport.offset().top ); 1401 1402 } 1403 1404 return pos; 1405 1406 }; /* o.getEleTopPosition() */ 1407 1408 /** 1409 * Get's the MAX top position for the element before it 1410 * is made sticky. In some cases the max could be less 1411 * than the original position of the element, which means 1412 * the element would always be sticky... in these instances 1413 * the max top will be set to the element's top position. 1414 * 1415 * @return {Integer} 1416 */ 1417 o.getEleMaxTop = function() { 1418 1419 var max = ( ( o.eleTop - o.topOffset )); 1420 1421 if (!o.isWindow) { 1422 1423 max = (max + o.eleTopMargin); 1424 1425 // If ele parent is not the viewport, then adjust the max top 1426 1427 1428 } 1429 1430 return max; 1431 1432 }; //end: o.getEleMaxTop() 1433 1434 /** 1435 * Gets the distance between the top of the element and the 1436 * top of the viewport. Basically the offset from the top of 1437 * the "page" inside the viewport. This distance is alwasy the 1438 * same even if the viewport is scrolled. The only time it 1439 * changes is when elements are inserted or removed above the 1440 * the Element or item above it are hidden/displayed. 1441 * Methods uses the Position() values until it reaches the 1442 * viewport 1443 */ 1444 o.getElementDistanceFromViewport = function($ele) { 1445 1446 var distance = $ele.position().top, 1447 $parent = $ele.offsetParent(); 1448 1449 // If the parent element is the root body element, then 1450 // we've reached the last possible offsetParent(). Exit 1451 if ($parent.is("body") || $parent.is("html")) { 1452 1453 return distance; 1454 1455 } 1456 1457 // If the positioned parent of this element is NOT 1458 // the viewport, then add the distance of that element's 1459 // top position 1460 if ($parent[0] !== o.viewport[0] ) { 1461 1462 distance = ( 1463 distance + 1464 o.getElementDistanceFromViewport( $parent ) 1465 ); 1466 1467 // ELSE, this is the viewport... Adjust the elements 1468 // Distance by adding on the amount of scroll the element 1469 // currently has 1470 } else { 1471 1472 distance = (distance + o.viewport.scrollTop()); 1473 1474 } 1475 1476 return distance; 1477 1478 }; /* end: .getElementDistanceFromViewport() */ 1479 1480 // If setParentOnStick is true, and the parent element 1481 // is the <body>
1481, then set setParentOnStick to false. 1482 if (o.setParentOnStick === true && o.eleParent.is("body")){ 1483 1484 o.setParentOnStick = false; 1485 1486 } 1487 1488 if (!$.isWindow(o.viewport[0])) { 1489 1490 o.isWindow = false; 1491 1492 } 1493 1494 /** 1495 * Adds this sticky element to the list of element for the viewport. 1496 * 1497 */ 1498 function addThisEleToViewportList() { 1499 1500 o.setEleTop(); 1501 1502 viewportKey = o.viewport.prop("stickOnScroll"); 1503 1504 // If the viewport is not the Window element, and the view port is not the 1505 // stick element's imediate offset parent, then we need to adjust the 1506 // top-offset so that element are position correctly. 1507 // See issue #3 on github 1508 if (!o.isWindow) { 1509 1510 o.isViewportOffsetParent = ( o.eleOffsetParent[0] === o.viewport[0] ); 1511 1512 } 1513 1514 // If this viewport is not yet defined, set it up now 1515 if (!viewportKey) { 1516 1517 viewportKey = "stickOnScroll" + String(Math.random()).replace(/\D/g,""); 1518 o.viewport.prop("stickOnScroll", viewportKey); 1519 viewports[viewportKey] = []; 1520 o.viewport.on("scroll", processElements); 1521 1522 } 1523 1524 // Push this element's data to this view port's array 1525 viewports[viewportKey].push(o); 1526 1527 // Trigger a scroll even 1528 o.viewport.trigger("scroll"); 1529 1530 } /* end: addThisEleToViewportList() */ 1531 1532 // If Element is not visible, then we have to wait until it is 1533 // in order to set it up. We need to obtain the top position of 1534 // the element in order to make the right decision when it comes 1535 // to making the element sticky. 1536 if (o.ele.is(":visible")) { 1537 1538 addThisEleToViewportList(); 1539 1540 } else { 1541 1542 setIntID = setInterval(function(){ 1543 1544 if (o.ele.is(":visible") || !setIntTries) { 1545 1546 clearInterval(setIntID); 1547 addThisEleToViewportList(); 1548 1549 } 1550 1551 --setIntTries; 1552 1553 }, 100); 1554 1555 } 1556 1557 return this; 1558 1559 });//end: each() 1560 1561 };//end: $.fn.stickOnScroll() 1562 1563}));
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.