1/* globals jQuery, mfn */ 2/* jshint esversion: 6 */ 3 4/** 5 * query loop masonry - prevents error with init in iframe 6 */ 7 8function queryLoopMasonry() { 9 jQuery('.mfn-query-loop-masonry:not(.mfn-initialized)').each(function() { 10 11 let $masonry = jQuery(this); 12 13 $masonry.imagesLoaded(function() { 14 15 $masonry.isotope({ 16 itemSelector: '.mfn-queryloop-item-wrapper', 17 layoutMode: 'masonry', 18 isOriginLeft: jQuery('body').hasClass('rtl') ? false : true 19 }); 20 21 $masonry.addClass('mfn-initialized'); 22 23 }); 24 25 }); 26} 27 28function msnryGalleryInit() { 29 30 // fix safari 31 jQuery('.gallery.equal-heights:not(.mfn-images-loaded)').each(function() { 32 var $el = jQuery(this); 33 $el.imagesLoaded(function() { 34 $el.addClass('mfn-images-loaded'); 35 }); 36 }); 37 38 jQuery('.sections_group .gallery, .mcb-section .gallery, .elementor-section .gallery').each(function() { 39 40 var $el = jQuery(this); 41 var id = $el.attr('id'); 42 43 if( $el.hasClass('mfn-initialized') ) return; 44 45 $el.children('br').remove(); 46 47 $el.find('.gallery-icon').children('a') 48 .wrap('<div class="image_frame scale-with-grid"><div class="image_wrapper"></div></div>') 49 .prepend('<div class="mask"></div>') 50 .children('img') 51 /*.css('height', 'auto') 52 .css('width', '100%')*/; 53 54 // lightbox | link to media file 55 56 if ($el.hasClass('file')) { 57 $el.find('.gallery-icon a') 58 .attr('rel', 'prettyphoto[' + id + ']') 59 .attr('data-elementor-lightbox-slideshow', id); // FIX: elementor lightbox gallery 60 } 61 62 $el.find( '.gallery-item' ).each(function(){ 63 var title = jQuery(this).data('title'); 64 var description = jQuery(this).data('description'); 65 jQuery('.gallery-icon a', jQuery(this)) 66 .attr('data-elementor-lightbox-title', title) 67 .attr('data-elementor-lightbox-description', description); 68 }); 69 70 // isotope for masonry layout 71 72 if ($el.hasClass('masonry')) { 73 74 /*mfnIsotope.addIsotopeLocation({ 75 name: 'Wordpress && Elementor - Masonry gallery', 76 location: $el, 77 settings: { 78 itemSelector: '.gallery-item', 79 layoutMode: 'masonry', 80 isOriginLeft: rtl ? false : true 81 } 82 }) 83 84 mfnIsotope.runIsotopes();*/ 85 86 $el.imagesLoaded(function() { 87 88 $el.isotope({ 89 itemSelector: '.gallery-item', 90 layoutMode: 'masonry', 91 isOriginLeft: jQuery('body').hasClass('rtl') ? false : true 92 }); 93 94 $el.addClass('mfn-initialized'); 95 96 }); 97 98 } 99 100 }); 101} 102 103function redrawAllRevolutionSliders() { 104 let slidersFound = false; 105 for (const prop in window) { 106 if (prop.startsWith('revapi') && typeof window[prop] === 'object' && window[prop] !== null) { 107 const revapiInstance = window[prop]; 108 109 if (typeof revapiInstance.revredraw === 'function') { 110 slidersFound = true; 111 setTimeout(function() { 112 revapiInstance.revredraw(); 113 console.log(`Revolution Slider instance (${prop}) redrawn.`); 114 }, 50); 115 } 116 } 117 } 118} 119 120(function($) { 121 122 "use strict"; 123 124 var scrollTicker, lightboxAttr, sidebar, 125 body = $('body'), 126 rtl = $('body').hasClass('rtl'), 127 simple = $('body').hasClass('style-simple'), 128 isBlocks = $('body').hasClass('builder-blocks'), 129 topBarTop = '0', 130 headerH = 0, 131 currWidth = $(window).width(), 132 newWidth = $(window).width(), 133 screen = 'desktop', 134 mobileInitW = mfn.mobileInit ? mfn.mobileInit : 1240, 135 consents = {}; // GDPR 2.0 136 137 /** 138 * Lightbox | Magnific Popup 139 */ 140 141 if ( ! mfn.lightbox.disable ) { 142 if ( ! ( mfn.lightbox.disableMobile && ( window.innerWidth < 768 ) ) ) { 143 lightboxAttr = { 144 title: mfn.lightbox.title ? mfn.lightbox.title : false, 145 }; 146 } 147 } 148 149 /** 150 * Cookies support 151 */ 152 153 var cookies = { 154 155 // cookies.get() 156 157 get: function(name){ 158 159 if (document.cookie !== "") { 160 var cookies = document.cookie.split(/; */); 161 162 for (var cookie of cookies) { 163 var [ cookieName, cookieVal ] = cookie.split("="); 164 165 if (cookieName === name) { 166 // console.log(cookieVal); 167 return decodeURIComponent(cookieVal); 168 } 169 } 170 } 171 172 return false;
173 }, 174 175 // cookies.set(); 176 177 set: function(name, value, expires){ 178 179 if(navigator.cookieEnabled) { 180 181 var cookieDate = new Date(); 182 var cookieText = ''; 183 184 expires = expires || 365; 185 value = encodeURIComponent(value); 186 187 cookieDate.setTime(cookieDate.getTime() + (expires * 24 * 60 * 60 * 1000)); 188 cookieText += name +"="+ value; 189 cookieText += "; expires=" + cookieDate.toUTCString() + ';'; 190 cookieText += "; path=" + mfn.home_url + '/'; 191 192 document.cookie = cookieText; 193 } 194 195 }, 196 197 }; 198 199 /** 200 * Google Consent Mode gtag 201 */ 202 203 var consent = { 204 205 popup : $('#mfn-consent-mode'), 206 207 // consent.tabs() 208 209 tabs : function($el, id){ 210 211 var $li; 212 213 if( $el ){ 214 $li = $el.closest('li'); 215 id = $li.data('id'); 216 } else { 217 $li = $('.tab[data-id="'+ id +'"]'); 218 } 219 220 // active 221 222 $li.addClass('is-active') 223 .siblings().removeClass('is-active'); 224 225 // open tab 226 227 $('#'+ id).addClass('is-active') 228 .siblings().removeClass('is-active'); 229 230 // middle button 231 232 $('.mfn-cookies').attr('data-tab',id); 233 234 }, 235 236 // consent.open() 237 238 open : function(){ 239 240 if( ! this.popup.length ){ 241 return; 242 } 243 244 if( $('body').hasClass('mfn-ui') ) return; 245 246 consents = cookies.get('mfnConsent'); 247 248 try { 249 250 consents = JSON.parse(consents); 251 252 if ( ! consents ){ 253 throw new Error(''); 254 } 255 256 // gtag update 257 gtag('consent', 'update', consents); 258 259 window.dataLayer = window.dataLayer || []; 260 window.dataLayer.push({ 261 event: 'mfn_consent_update', 262 mfn_consent: consents, 263 analytics_storage: consents.analytics_storage, 264 ad_storage: consents.ad_storage, 265 ad_user_data: consents.ad_user_data, 266 ad_personalization: consents.ad_personalization 267 }); 268 269 } catch (e) { 270 271 consents = { 272 'ad_storage': 'denied', 273 'ad_user_data': 'denied', 274 'ad_personalization': 'denied', 275 'analytics_storage': 'denied' 276 } 277 278 body.addClass('mfn-cookies-open'); 279 if( body.hasClass('gdpr2-scroll-disable') ){ 280 $('html').addClass('mfn-popup-browser-scroll-disabled'); 281 } 282 283 } 284 285 }, 286 287 // consent.reopen() 288 289 reopen : function(){ 290 291 if( $('body').hasClass('mfn-ui') ) return; 292 293 body.addClass('mfn-cookies-open'); 294 this.popup.show() 295 .children().show(); 296 297 if( body.hasClass('gdpr2-scroll-disable') ){ 298 $('html').addClass('mfn-popup-browser-scroll-disabled'); 299 } 300 301 }, 302 303 // consent.close() 304 305 close : function(){ 306 307 var closeAnimation = this.popup.attr('data-animation'); 308 309 switch(true){ 310 case 'fade' === closeAnimation: 311 this.popup.fadeOut(300); 312 break; 313 case 'slide' === closeAnimation: 314 this.popup.fadeOut(300); 315 this.popup.children().slideUp(300); 316 break; 317 default: 318 body.removeClass('mfn-cookies-open'); 319 } 320 321 // wait for animation end, then remove clasa and set cookies 322 setTimeout(function(){ 323 body.removeClass('mfn-cookies-open'); 324 if( body.hasClass('gdpr2-scroll-disable') ){ 325 $('html').removeClass('mfn-popup-browser-scroll-disabled'); 326 } 327 $(document).trigger('mfn:gdpr2:close'); 328 }, 300); 329 330 }, 331 332 // consent.set() 333 334 set : function(){ 335 336 var expires = this.popup.attr('data-expires'); 337 expires = parseInt(expires) || 365; 338 339 // gtag update 340 gtag('consent', 'update', consents); 341 342 window.dataLayer = window.dataLayer || []; 343 window.dataLayer.push({ 344 event: 'mfn_consent_update', 345 mfn_consent: consents, 346 analytics_storage: consents.analytics_storage, 347 ad_storage: consents.ad_storage, 348 ad_user_data: consents.ad_user_data, 349 ad_personalization: consents.ad_personalization 350 }); 351 352 // cookies set 353 cookies.set('mfnConsent', JSON.stringify(consents), expires); 354 355 // popup close 356 consent.close(); 357 358 }, 359 360 // consent.all() 361 362 all : function(){ 363 364 consents = { 365 'ad_storage': 'granted', 366 'ad_user_data': 'granted', 367 'ad_personalization': 'granted',
368 'analytics_storage': 'granted' 369 } 370 371 consent.set(); 372 373 }, 374 375 // consent.selected() 376 377 selected : function(){ 378 379 if( $('#cookies_analytics').is(":checked") ){ 380 consents.analytics_storage = 'granted'; 381 } 382 383 if( $('#cookies_marketing').is(":checked") ){ 384 consents.ad_storage = 'granted'; 385 consents.ad_user_data = 'granted'; 386 consents.ad_personalization = 'granted'; 387 } 388 389 consent.set(); 390 391 }, 392 393 // consent.deny() 394 395 deny : function(){ 396 397 consents = { 398 'ad_storage': 'denied', 399 'ad_user_data': 'denied', 400 'ad_personalization': 'denied', 401 'analytics_storage': 'denied' 402 } 403 404 consent.set(); 405 406 }, 407 408 }; 409 410 /** 411 * Calculate top bar initial position for sticky header and fixed headers like modern 412 */ 413 414 function topBarTopPosition(){ 415 416 topBarTop = parseInt($('#Top_bar').css('top'), 10); 417 418 // page has already been scrolled and is refreshed or is opened with #hash 419 420 var scrollPos = $(window).scrollTop(); 421 422 if( scrollPos > 0 ){ 423 window.scrollTo(0, 0); 424 $(window).scrollTop(0); 425 topBarTop = parseInt($('#Top_bar').css('top'), 10); 426 window.scrollTo(0, scrollPos); 427 } 428 429 // negative top bar top value 430 431 if (topBarTop < 0){ 432 topBarTop = 0; 433 } 434 435 topBarTop = topBarTop + 'px'; 436 437 } 438 439 /** 440 * Admin Bar & WooCommerce Store Notice 441 */ 442 443 function adminBarH() { 444 445 var height = 0; 446 447 // WP adminbar 448 449 if ($('body').hasClass('admin-bar')) { 450 var actionBarH = $('#wpadminbar').innerHeight() || 0; 451 height += actionBarH; 452 } 453 454 // WC demo store 455 456 if ($('body').hasClass('woocommerce-demo-store')) { 457 var demoStoreH = $('body > p.demo_store').innerHeight() || 0; 458 height += demoStoreH; 459 } 460 461 return height; 462 } 463 464 /** 465 * Header | Sticky 466 */ 467 468 function mfnSticky() { 469 470 if( ! $('body').hasClass('sticky-header') ){ 471 return false; 472 } 473 474 if( $('body').hasClass('header-creative') && window.innerWidth >= 768 ){ 475 return false; 476 } 477 478 var startY = headerH; 479 var windowY = $(window).scrollTop(); 480 var topBarH = $('#Top_bar').height() || 0; 481 482 if ( windowY > startY ) { 483 484 if ( ! ( $('#Top_bar').hasClass('is-sticky') ) ) { 485 486 $('.header_placeholder').css('height', topBarH); 487 488 $('#Top_bar') 489 .addClass('is-sticky') 490 .css('top', -60) 491 .animate({ 492 'top': adminBarH() + 'px' 493 }, 300); 494 495 headerWidth(); 496 497 $(document).trigger('mfn:header:sticky:on'); 498 } 499 500 } else { 501 502 if ($('#Top_bar').hasClass('is-sticky')) { 503 504 $('.header_placeholder').css('height', 0); 505 $('#Top_bar').stop() 506 .removeClass('is-sticky') 507 .css('top', topBarTop); 508 509 stickyLogo(); 510 headerWidth(); 511 512 $(document).trigger('mfn:header:sticky:off'); 513 514 } 515 516 } 517 518 } 519 520 /** 521 * Header | Sticky | Retina Logo - max height 522 */ 523 524 function stickyLogo() { 525 526 // ! retina display 527 528 if( window.devicePixelRatio <= 1 ){ 529 return false; 530 } 531 532 var parent = $('#Top_bar #logo'), 533 el = $('img.logo-main', parent), 534 height = el.data('height'); 535 536 // ! retina logo set 537 if ( ! parent.hasClass('retina')) { 538 return false; 539 } 540 541 if ( $('body').hasClass('logo-overflow') ) { 542 // do nothing 543 } else if ( height > parent.data('height') ) { 544 height = parent.data('height'); 545 } 546 547 el.css('max-height', height + 'px'); 548 549 } 550 551 /** 552 * Header | Sticky | Height 553 */ 554 555 function mfnStickyH() { 556 557 var topBarH = $('#Top_bar').innerHeight() || 0; 558 559 if ( $('body').hasClass('header-below') ) { 560 561 // header below slider 562 563 var sliderH = $('.mfn-main-slider').innerHeight() || 0; 564 565 headerH = topBarH + sliderH; 566 567 } else { 568 569 // default 570 571 var actionBarH = $('#Action_bar').innerHeight() || 0; 572 573 headerH = topBarH + actionBarH; 574 575 } 576 577 } 578 579 /** 580 * Header | Sticky | Mobile 581 */ 582 583 function mfnMobileSticky() { 584 585 if( ! $('body').hasClass('.mobile-sticky') ){ 586 return false; 587 } 588 589 if( $(window).width() >= 768 ){ 590 return false;
591 } 592 593 var menuH, 594 windowH = $(window).height() || 0, 595 logoH = $('#Top_bar .logo').height() || 0, 596 offset = adminBarH() + logoH; 597 598 if ( ( ! $('#Top_bar').hasClass('is-sticky')) && $('#Action_bar').is(':visible') ) { 599 offset += $('#Action_bar').height() || 0; 600 } 601 602 menuH = windowH - offset; 603 604 if (menuH < 176) { 605 menuH = 176; 606 } 607 608 $('#Top_bar #menu').css('max-height', menuH + 'px'); 609 610 } 611 612 /** 613 * Header | Top bar left | Width 614 */ 615 616 function headerWidth() { 617 618 var rightW = $('.top_bar_right').outerWidth() || 0; 619 620 rightW = Math.ceil( rightW ); 621 622 if( $('body').hasClass('header-modern') ){ 623 rightW += 10; 624 } 625 626 var parentW = $('#Top_bar .one').width() || 0; 627 var leftW = parentW - rightW; 628 629 } 630 631 /** 632 * FIX | Header | Sticky | Height 633 */ 634 635 function fixStickyHeaderH() { 636 637 var stickyH = 0; 638 639 // FIX | sticky top bar height 640 641 var topBar = $('.sticky-header #Top_bar'); 642 643 if( topBar.length ){ 644 645 // default headers 646 647 if (topBar.hasClass('is-sticky')) { 648 stickyH = $('.sticky-header #Top_bar').innerHeight() || 0; 649 } else { 650 topBar.addClass('is-sticky'); 651 stickyH = $('.sticky-header #Top_bar').innerHeight() || 0; 652 topBar.removeClass('is-sticky'); 653 } 654 655 } else if( $('.mfn-header-tmpl-builder').length ) { 656 657 var height = 15; 658 var shift = 0; 659 660 if( $('#mfn-header-template').hasClass('mfn-hasSticky') ){ 661 height = $('#mfn-header-template').outerHeight(); 662 shift = parseFloat($('#mfn-header-template').css('top')); 663 }else if( $('#mfn-header-template').hasClass('mfn-header-tmpl-fixed') ){ 664 height = $('#mfn-header-template').outerHeight(); 665 shift = parseFloat($('#mfn-header-template').css('top')); 666 }else if( $('#mfn-header-template').hasClass('mfn-mobile-header-tmpl-fixed') && $(window).width() < 767 ) { 667 height = $('#mfn-header-template').outerHeight(); 668 shift = parseFloat($('#mfn-header-template').css('top')); 669 } 670 671 stickyH = height + shift; 672 673 return stickyH; 674 675 } 676 677 // FIX | responsive 678 679 if ( $(window).width() < mobileInitW ) { 680 681 if ( $(window).width() < 768 ) { 682 683 // mobile 684 if (!$('body').hasClass('mobile-sticky')) { 685 stickyH = 0; 686 } 687 688 } else { 689 690 // tablet 691 if (!$('body').hasClass('tablet-sticky')) { 692 stickyH = 0; 693 } 694 695 } 696 697 } else { 698 699 // desktop 700 701 // FIX | header creative 702 if ($('body').hasClass('header-creative')) { 703 stickyH = 0; 704 } 705 706 } 707 708 return stickyH; 709 } 710 711 /** 712 * Sidebar | Height 713 */ 714 715 function mfnSidebar() { 716 if ($('.mcb-sidebar').length) { 717 718 var maxH = $('#Content .sections_group').outerHeight(); 719 720 $('.mcb-sidebar').each(function() { 721 $(this).css('min-height', 0); 722 if ($(this).height() > maxH) { 723 maxH = $(this).height(); 724 } 725 }); 726 727 $('.mcb-sidebar').css('min-height', maxH + 'px'); 728 729 if( sidebar ){ 730 sidebar.stickySidebar('updateSticky'); 731 } 732 733 } 734 } 735 736 737 /** 738 * Into | Full Screen 739 */ 740 741 function mfnIntroH() { 742 743 var windowH = $(window).height() || 0; 744 var headerWrapperH = $('#Header_wrapper').height() || 0; 745 746 windowH = windowH - headerWrapperH - adminBarH(); 747 748 $('#Intro.full-screen').each(function() { 749 750 var el = $(this), 751 inner = $('.intro-inner', el), 752 innerH = inner.height() || 0; 753 754 el.css('padding', 0).css('min-height', windowH); 755 756 var padding = ( windowH - innerH ) / 2; 757 inner.css('padding-top', padding).css('padding-bottom', padding); 758 759 }); 760 } 761 762 /** 763 * Footer | Sliding | Height 764 */ 765 766 function mfnFooter() { 767 768 var footerH = $('#Footer').height() || 0; 769 770 // Fixed, Sliding 771 772 if ($('.footer-fixed #Footer, .footer-sliding #Footer').length) { 773 774 footerH = footerH - 1; 775 $('#Content').css('margin-bottom', footerH + 'px'); 776 777 } 778 779 // Stick to bottom 780 781 if ($('.footer-stick #Footer').length) { 782 783 var headerWrapperH = $('#Header_wrapper').height() || 0; 784 785 var headerFooterH = headerWrapperH + footerH; 786 787 var documentH = $(document).height() - adminBarH(); 788 789 if ( ( documentH <= $(window).height() ) && ( headerFooterH <= $(window).height() ) ) { 790 $('#Footer').addClass('is-sticky'); 791 } else { 792 $('#Footer').removeClass('is-sticky'); 793 } 794 795 } 796 797 } 798 799 /** 800 * Back To Top | Sticky / Show on scroll 801 */ 802 803 function backToTopSticky() { 804 805 if ($('#back_to_top.sticky.scroll').length) { 806 var el = $('#back_to_top.sticky.scroll'); 807 808 // Clear Timeout if one is pending 809 if (scrollTicker) { 810 window.clearTimeout(scrollTicker); 811 scrollTicker = null; 812 } 813 814 el.addClass('focus'); 815 816 // Set Timeout 817 scrollTicker = window.setTimeout(function() { 818 el.removeClass('focus'); 819 }, 1500); // Timeout in msec 820 821 } 822 823 } 824 825 /** 826 * Preloader 827 */ 828 829 function preloader(){ 830 $('body.preloader').animate({ 831 opacity: 1 832 }, 100, function(){ 833 $('html').removeClass('preloading'); 834 }); 835 } 836 837 /** 838 * # Hash smooth navigation 839 */ 840 841 function hashNav() { 842 843 var hash = window.location.hash; 844 845 if (hash) { 846 847 // FIX | Master Slider 848 849 if (hash.indexOf("&") > -1 || hash.indexOf("/") > -1 || hash.indexOf("?") > -1) { 850 return false;
851 } 852 853 // Contact Form 7 in popup 854 855 if (hash.indexOf("wpcf7") > -1) { 856 cf7popup(hash); 857 } 858 859 if ($(hash).length) { 860 861 $(window).scrollTop(0, 0); 862 863 setTimeout(function() { 864 865 var offset = 0, 866 headerH = fixStickyHeaderH(), 867 tabH = $(hash).siblings('.ui-tabs-nav').innerHeight() || 0; 868 869 // header builder 870 871 if( $('body').hasClass('mhb') ){ 872 873 var currentView = $('.mhb-view').filter(':visible'); 874 headerH = currentView.height() || 0; 875 876 } 877 878 offset = headerH + tabH; 879 880 $('html, body').animate({ 881 scrollTop: $(hash).offset().top - offset 882 }, 500, function(){ 883 $('html, body').animate({ 884 scrollTop: $(hash).offset().top - offset 885 }, 75); 886 }); 887 888 }, 500); 889 890 } 891 892 893 } 894 895 } 896 897 /** 898 * One Page | Scroll Active 899 */ 900 901 function onePageActive() { 902 if ($('body').hasClass('one-page')) { 903 904 var stickyH = $('.sticky-header #Top_bar').innerHeight() || 0; 905 if( $('#mfn-header-template').length ) stickyH = $('#mfn-header-template').innerHeight() || 0; 906 var windowT = $(window).scrollTop(); 907 var start = windowT + stickyH + adminBarH() + 1; 908 var first = false; 909 910 $('[data-id]:not(.elementor-element), section[data-id]').each(function() { 911 912 // FIX | elementor adds own data-id for each section 913 914 if( $(this).attr('data-id') && ( -1 == $(this).attr('data-id').indexOf('#') ) ){ 915 return true; 916 } 917 918 if ($(this).visible(true)) { 919 920 if (!first) { 921 first = $(this); 922 } else if (($(this).offset().top < start) && ($(this).offset().top > first.offset().top)) { 923 first = $(this); 924 } 925 } 926 927 if (first) { 928 929 var newActive = first.attr('data-id'); 930 var active = '[data-hash="' + newActive + '"]'; 931 932 if (newActive) { 933 var menu = $('#menu, .mhb-menu'); 934 if( $('#mfn-header-template').length ) menu = $('#mfn-header-template .mfn-header-menu'); 935 menu.find('li').removeClass('current-menu-item current-menu-parent current-menu-ancestor current_page_item current_page_parent current_page_ancestor'); 936 $(active, menu) 937 .closest('li').addClass('current-menu-item') 938 .closest('.menu > li').addClass('current-menu-item'); 939 } 940 941 } 942 943 }); 944 945 } 946 } 947 948 /** 949 * Contact Form 7 | Popup 950 */ 951 952 function cf7popup(hash) { 953 if (hash && $(hash).length) { 954 var id = $(hash).closest('.popup-content').attr('id'); 955 956 $('a.popup-link[href="#' + id + '"]:not(.once)') 957 .addClass('once') 958 .trigger('click'); 959 960 } 961 } 962 963 /** 964 * $(document).mfnPopupInit 965 * init js plugins on popup open 966 */ 967 968 $(document).on('mfnPopupInit', function() { 969 970 // chart 971 972 if( $('.mfn-popup-tmpl.mfn-popup-active .chart:not(.mfn-initialized)').length ){ 973 $('.mfn-popup-tmpl.mfn-popup-active .chart:not(.mfn-initialized)').each(function() { 974 var lineW = simple ? 4 : 8; 975 $(this).addClass('mfn-initialized'); 976 $(this).easyPieChart({ 977 animate: 1000, 978 lineCap: 'circle', 979 lineWidth: lineW, 980 size: 140, 981 scaleColor: false 982 }); 983 984 }); 985 } 986 987 // before after 988 989 if( $('.mfn-popup-tmpl.mfn-popup-active .before_after.twentytwenty-container:not(.mfn-initialized)').length ){ 990 991 $('.mfn-popup-tmpl.mfn-popup-active .before_after.twentytwenty-container:not(.mfn-initialized)').each(function(){ 992 993 var el = $(this); 994 el.addClass('mfn-initialized'); 995 el.imagesLoaded().done(function(instance, image){ 996 queueMicrotask(() => el.twentytwenty()); 997 }); 998 999 }); 1000 } 1001 1002 // countdown 1003 1004 if( $('.mfn-popup-tmpl.mfn-popup-active .downcount:not(.mfn-initialized)').length ){ 1005 $('.mfn-popup-tmpl.mfn-popup-active .downcount:not(.mfn-initialized)').each(function() { 1006 var el = $(this); 1007 el.addClass('mfn-initialized'); 1008 el.downCount({ 1009 date: el.attr('data-date'), 1010 offset: el.attr('data-offset') 1011 }); 1012 }); 1013 } 1014 1015 // counter 1016 1017 if( $('.mfn-popup-tmpl.mfn-popup-active .animate-math .number:not(.mfn-initialized)').length ){ 1018 $('.mfn-popup-tmpl.mfn-popup-active .animate-math .number:not(.mfn-initialized)').each(function() { 1019 1020 var el = $(this); 1021 var duration = Math.floor((Math.random() * 1000) + 1000); 1022 var to = el.attr('data-to'); 1023 1024 el.addClass('mfn-initialized'); 1025 1026 $({ 1027 property: 0 1028 }).animate({ 1029 property: to 1030 }, { 1031 duration: duration, 1032 easing: 'linear', 1033 step: function() { 1034 el.text(Math.floor(this.property)); 1035 }, 1036 complete: function() { 1037 el.text(this.property); 1038 } 1039 }); 1040 1041 }); 1042 } 1043 1044 }); 1045 1046 $(document).on('mfn:ajax:refresh', function() { 1047 1048 if( $('.mfn-looped-items-slider').length ) { 1049 queryLoopSlider(); 1050 } 1051 1052 bannerBox.init(); 1053 1054 mfnReadMore.prepare(); 1055 1056 mfnTabber.sliding_bg(); 1057 1058 if( $('.mfn-advanced-filters').length ) mfnAdvancedFilters.prepare(); 1059 1060 if( $('.mfn-floating-placeholder').length ){ 1061 $('.mfn-floating-placeholder .mfn-input-wrapper input').each(function() { 1062 if( $(this).val().length ){ 1063 $(this).closest('.mfn-input-wrapper').addClass('mfn-not-empty'); 1064 }else{ 1065 $(this).closest('.mfn-input-wrapper').removeClass('mfn-not-empty'); 1066 } 1067 }); 1068 } 1069 1070 $('.downcount:not(.mfn-initialized)').each(function() { 1071 var el = $(this); 1072 el.addClass('mfn-initialized'); 1073 el.downCount({ 1074 date: el.attr('data-date'), 1075 offset: el.attr('data-offset') 1076 }); 1077 }); 1078 1079 }) 1080 1081 /** 1082 * $(document).ready 1083 * Specify a function to execute when the DOM is fully loaded. 1084 */ 1085 1086 $(document).ready(function() { 1087 1088 if( $('.mfn-off-canvas-sidebar').length ){ 1089 offCanvasSidebar.init(); 1090 } 1091 1092 if( $('.mfn-advanced-filters').length ){ 1093 mfnAdvancedFilters.init(); 1094 } 1095 1096 mfnTabber.init(); 1097 1098 1099 if( $(window).width() < 767 && !$('.mfn-off-canvas-sidebar').length ){ 1100 offCanvasSidebar.mobile(); 1101 screen = 'mobile'; 1102 }else if($(window).width() < 959){ 1103 screen = 'tablet'; 1104 } 1105 1106 if( $('.mfn-floating-placeholder').length ){ 1107 $(document).on('blur change', '.mfn-floating-placeholder .mfn-input-wrapper input', function() { 1108 if( $(this).val().length ){ 1109 $(this).closest('.mfn-input-wrapper').addClass('mfn-not-empty'); 1110 }else{ 1111 $(this).closest('.mfn-input-wrapper').removeClass('mfn-not-empty'); 1112 } 1113 }); 1114 1115 $('.mfn-floating-placeholder .mfn-input-wrapper input').each(function() { 1116 if( $(this).val().length ){ 1117 $(this).closest('.mfn-input-wrapper').addClass('mfn-not-empty'); 1118 }else{ 1119 $(this).closest('.mfn-input-wrapper').removeClass('mfn-not-empty'); 1120 } 1121 }); 1122 } 1123 1124 /** 1125 * 1126 * ELEMENTOR fix single post 1127 * 1128 * */ 1129 1130 if( $('body').hasClass('single-post') && $('.mfn-tmp-elementor-content').length && $('.column.column_post_content').length ){ 1131 $('.column.column_post_content .mcb-item-post_content-inner').html( $('.mfn-tmp-elementor-content').html() ); 1132 $('.mfn-tmp-elementor-content').remove(); 1133 } 1134 1135 if( $('.mfn-share-post-copy-link').length ){ 1136 $('.mfn-share-post-copy-link').on('click', function(e) { 1137 e.preventDefault(); 1138 var $link = $(this); 1139 navigator.clipboard.writeText( window.location.href ); 1140 $link.addClass('tooltip').attr('data-tooltip', mfn.translation.success_message); 1141 setTimeout(function() { 1142 $link.removeClass('tooltip').removeAttr('data-tooltip'); 1143 }, 2000); 1144 }); 1145 } 1146 1147 if( $('.mfn-image-hotspot').length ){ 1148 1149 mfn_hotspot.init(); 1150 1151 } 1152 1153 /** 1154 * 1155 * Link go to section 1156 * 1157 * */ 1158 1159 if( $('.mfn-go-to').length ) { 1160 $(document).on('click', '.mfn-go-to', function(e) { 1161 e.preventDefault(); 1162 let target = $(this).attr('data-mfngoto'); 1163 let offset = 0; 1164 1165 if( target == 'last' ){ 1166 offset = $('#Content .mfn-builder-content > .section').last().offset().top; 1167 }else if( target == 'prev' ){ 1168 if( !$(this).closest('.section').prev('.section').length ) {console.error('BeTheme: Prev section doesnt exists'); return; } 1169 offset = $(this).closest('.section').prev('.section').offset().top; 1170 }else{ 1171 if( !$(this).closest('.section').next('.section').length ) {console.error('BeTheme: Next section doesnt exists'); return; } 1172 offset = $(this).closest('.section').next('.section').offset().top; 1173 } 1174 1175 offset = offset - ( fixStickyHeaderH() + adminBarH() ); 1176 1177 $('html,body').animate({ scrollTop: offset }, 500); 1178 1179 1180 }); 1181 } 1182 1183 1184 let js_tooltip = {
1185 button: false, 1186 offset_top: false, 1187 offset_left: false, 1188 init: function() { 1189 $('.js-tooltip').on('mouseenter', function() { 1190 js_tooltip.button = $(this); 1191 if( typeof js_tooltip.button.attr('data-tooltip') == 'undefined' ) return; 1192 1193 $('body').append('<span class="js-tooltip-txt">'+js_tooltip.button.attr('data-tooltip')+'</span>'); 1194 js_tooltip.position(); 1195 1196 }).on('mouseleave', function() { 1197 if( $('.js-tooltip-txt').length ) $('.js-tooltip-txt').remove(); 1198 js_tooltip.button = false; 1199 }); 1200 1201 $(window).on('scroll', function() { 1202 if( js_tooltip.button ) js_tooltip.position(); 1203 }); 1204 1205 }, 1206 position: function() { 1207 let offset = js_tooltip.button.offset(); 1208 js_tooltip.offset_top = offset.top - $(window).scrollTop() - 8; 1209 js_tooltip.offset_left = offset.left + (js_tooltip.button.outerWidth()/2); 1210 1211 if( js_tooltip.button && $('.js-tooltip-txt').length ) $('.js-tooltip-txt').css({ top: js_tooltip.offset_top+'px', left: js_tooltip.offset_left+'px' }); 1212 } 1213 } 1214 1215 if( $('.js-tooltip').length ) js_tooltip.init(); 1216 1217 1218 1219 /** 1220 * 1221 * Button copy to clipboard 1222 * 1223 * */ 1224 1225 if( $('.mfn-copy-to-clipboard').length ) { 1226 $(document).on('click', '.mfn-copy-to-clipboard', function(e) { 1227 e.preventDefault(); 1228 let code = $(this).attr('data-mfncopycode'); 1229 let button = $(this); 1230 let org_label = button.find('.button_label').text(); 1231 let copied_txt = button.attr('data-mfncopyconfirm'); 1232 1233 navigator.clipboard.writeText(code); 1234 1235 if( button.hasClass('js-tooltip') ) { 1236 org_label = button.attr('data-tooltip'); 1237 button.attr('data-tooltip', copied_txt); 1238 if( $('.js-tooltip-txt').length ) $('.js-tooltip-txt').remove(); 1239 button.trigger('mouseenter'); 1240 }else{ 1241 button.find('.button_label').text(copied_txt); 1242 } 1243 1244 button.on('mouseleave', function() { 1245 button.blur(); 1246 }); 1247 1248 setTimeout(function() { 1249 if( button.hasClass('js-tooltip') ) { 1250 button.attr('data-tooltip', org_label); 1251 if( $('.js-tooltip-txt').length ) $('.js-tooltip-txt').remove(); 1252 button.trigger('mouseenter'); 1253 }else{ 1254 button.find('.button_label').text(org_label); 1255 } 1256 }, 2000); 1257 1258 }); 1259 } 1260 1261 /** 1262 * 1263 * WPML language switcher 1264 * 1265 * */ 1266 1267 if( $('.mfn-language-switcher-dropdown:not(.mfn-initialized)').length ) { 1268 $('.mfn-language-switcher-dropdown:not(.mfn-initialized)').each(function() { 1269 let that = $(this); 1270 that.addClass('mfn-initialized'); 1271 1272 let $ul = that.find('ul'); 1273 let $current = $ul.find('li.wpml-ls-current-language'); 1274 1275 $current.append($ul.clone()); 1276 1277 $ul.children('li:not(.wpml-ls-current-language)').remove(); 1278 1279 $current.find('ul li.wpml-ls-current-language').remove(); 1280 1281 if( that.hasClass('mfn-language-switcher-dropdown-icon') ){ 1282 let icon_html = ''; 1283 if( that.attr('data-icon') == 'image' ){ 1284 icon_html = '<span class="mfn-arrow-icon"><img src="'+that.attr('data-path')+'" alt=""></span>'; 1285 }else if( that.attr('data-icon') == 'icon' ){ 1286 icon_html = '<span class="mfn-arrow-icon"><i class="'+that.attr('data-path')+'"></i></span>'; 1287 } 1288 1289 $current.children('a').append(icon_html); 1290 } 1291 1292 }); 1293 1294 $(document).on('click', '.mfn-language-switcher-dropdown ul li.wpml-ls-current-language > a', function(e) { 1295 if( $(window).width() < 1240 ) e.preventDefault(); 1296 $(this).parent('li').toggleClass('hover'); 1297 }).on('mouseleave', '.mfn-language-switcher-dropdown ul li.wpml-ls-current-language.hover', function(e) { 1298 $('.mfn-language-switcher-dropdown ul li.hover').removeClass('hover'); 1299 }); 1300 1301 } 1302 1303 /** 1304 * Isotope 1305 */ 1306 1307 class Isotope { 1308 constructor(){ 1309 this.runIsotopes = this.runIsotopes.bind(this); 1310 this.itemToModify = {}; 1311 this.ajaxObjects = []; 1312 } 1313 1314 get getList() { 1315 return [ 1316 { 1317 name: 'Portfolio - Isotope', 1318 location: '.blog_wrapper .isotope:not( .masonry ), .portfolio_wrapper .isotope:not( .masonry-flat, .masonry-hover, .masonry-minimal )', 1319 beforeActive: () => null, 1320 afterActive: () => null, 1321 settings: { 1322 itemSelector: '.isotope-item', 1323 layoutMode: 'fitRows', 1324 isOriginLeft: rtl ? false : true 1325 } 1326 }, 1327 { 1328 name: 'Portfolio - Masonry Flat', 1329 location: '.portfolio_wrapper .masonry-flat', 1330 beforeActive: () => null, 1331 afterActive: () => null, 1332 settings: { 1333 itemSelector: '.isotope-item', 1334 percentPosition: true, 1335 masonry: { columnWidth: 1 }, 1336 isOriginLeft: rtl ? false : true 1337 } 1338 }, 1339 { 1340 name: 'Blog & Portfolio & Shop - Masonry', 1341 location: '.isotope.masonry, .isotope.masonry-hover, .isotope.masonry-minimal', 1342 beforeActive: () => null, 1343 afterActive: () => null, 1344 settings: { 1345 itemSelector: '.isotope-item', 1346 layoutMode: 'masonry', 1347 isOriginLeft: rtl ? false : true 1348 } 1349 }, 1350 /*{ 1351 name: 'General - Masonry Isotope', 1352 location: '.masonry.isotope, .masonry.gallery', 1353 beforeActive: () => null, 1354 afterActive: () => null, 1355 settings: {} 1356 }, 1357 { 1358 name: 'General - Isotope', 1359 location: '.isotope', 1360 beforeActive: () => null, 1361 afterActive: () => null, 1362 settings: {}, 1363 },*/ 1364 { 1365 name: 'Filters - Isotope Event on Click', 1366 location: 'body:not(.tax-portfolio-types,.archive.category,.archive.tag,.archive.author) .isotope-filters .filters_wrapper', 1367 beforeActive: () => null, 1368 afterActive: ({location}) => { 1369 const filterButtons = $(location).find('li:not(.close) a'); 1370 filterButtons.on('click', (e) => { 1371 e.preventDefault(); 1372 const buttonClicked = $(e.target); 1373
1374 let isoWrapper = $('.isotope'), 1375 filters = buttonClicked.closest('.isotope-filters'), 1376 parent = filters.attr('data-parent'); 1377 1378 if (parent) { 1379 parent = filters.closest('.' + parent); 1380 isoWrapper = parent.find('.isotope').first(); 1381 } 1382 1383 filters.find('li').removeClass('current-cat'); 1384 buttonClicked.closest('li').addClass('current-cat'); 1385 1386 // $('.isotope-filters .filters_wrapper').find('li').removeClass('current-cat'); 1387 this.isotopeFilter(buttonClicked, isoWrapper); 1388 }) 1389 }, 1390 settings: 'do-not-run' 1391 }, 1392 ...this.ajaxObjects //dynamical loaded content, like load more. 1393 ] 1394 } 1395 1396 // One liners, queries to isotope API 1397 addEventListener(onEvent, doWhat) { 1398 return $(document).on( `isotope:${onEvent}`, doWhat) 1399 } 1400 queryIsotopeAPI(location, apiAction, actionToPass) { 1401 return $(location).isotope(apiAction, actionToPass); 1402 }; 1403 triggerIsotopeEvent(doWhat) { 1404 return $(document).trigger(`isotope:${doWhat}`) 1405 } 1406 1407 // Add elements which require isotope and are loaded on the fly 1408 addIsotopeLocation( payload ) { 1409 if ( !payload.location ) return console.error('MfnIsotope Error: No Location Provided!'); 1410 1411 // Push it to object 1412 this.ajaxObjects.push( 1413 { 1414 name: payload.name ? payload.name : 'No name applied - Dynamic Isotope Function', 1415 location: payload.location, 1416 beforeActive: payload.beforeActive ? payload.beforeActive : () => null, 1417 afterActive: payload.afterActive ? payload.afterActive : () => null, 1418 settings: payload.settings ? payload.settings : {} 1419 } 1420 ); 1421 1422 // Reload it anyway while using that option 1423 $( payload.location ).isotope( payload.settings ) 1424 } 1425 1426 isotopeFilter( domEl, isoWrapper ) { 1427 if( !domEl || !isoWrapper ) return console.error('MfnIsotope Error: isotopeFilter, missing one of the values!'); 1428 const filter = domEl.attr('data-rel'); 1429 1430 isoWrapper.isotope({ filter }); 1431 1432 queueMicrotask(() => $(window).trigger('resize')); 1433 1434 setTimeout(function() { 1435 mfnIsotope.triggerIsotopeEvent('arrange'); 1436 }, 500); 1437 } 1438 1439 // Usually for init, turn on all of the isotopes! 1440 runIsotopes( resize = true ) { 1441 const isotopeList = this.getList; 1442 1443 isotopeList.map(item => { 1444 1445 if( $(item.location).length ) { 1446 // HOOK, before isotope binding 1447 item.beforeActive(item) 1448
1449 // Trigger resize to recalculate some plugins stuff 1450 if( resize ){ 1451 $(window).trigger('resize'); 1452 } 1453 1454 // Isotope init 1455 if( 'do-not-run' !== item.settings ){ 1456 queueMicrotask(() => $( item.location ).isotope( item.settings )); 1457 } 1458 1459 // HOOK, after isotope binding 1460 item.afterActive(item); 1461 } 1462 }); 1463 } 1464 } 1465 1466 const mfnIsotope = new Isotope; 1467 mfnIsotope.runIsotopes(); 1468 1469 /** 1470 * Waypoints 1471 */ 1472 1473 class Waypoints { 1474 constructor(){ 1475 this.runWaypoints = this.runWaypoints.bind(this); 1476 } 1477 1478 get getList() { 1479 return [ 1480 { 1481 name: 'Chart', 1482 location: '.sections_group .chart, .elementor-section .chart', 1483 beforeActive: () => {}, 1484 afterActive: () => {}, 1485 settings: () => { 1486 return { 1487 offset: '100%', 1488 triggerOnce: true, 1489 handler: function(){ 1490 var el = $(this.element).length ? $(this.element) : $(this); 1491 var lineW = simple ? 4 : 8; 1492 1493 el.easyPieChart({ 1494 animate: 1000, 1495 lineCap: 'circle', 1496 lineWidth: lineW, 1497 size: 140, 1498 scaleColor: false 1499 }); 1500 1501 if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { 1502 this.destroy(); 1503 } 1504 } 1505 } 1506 } 1507 }, 1508 { 1509 name: 'Progress Icons', 1510 location: '.progress_icons', 1511 beforeActive: () => {}, 1512 afterActive: () => {}, 1513 settings: () => { 1514 return { 1515 offset: '100%', 1516 triggerOnce: true, 1517 handler: function() { 1518 var el = $(this.element).length ? $(this.element) : $(this); 1519 var active = el.attr('data-active'); 1520 var color = el.attr('data-color'); 1521 var transparent = el.hasClass('transparent'); 1522 var icon = el.find('.progress_icon'); 1523 var timeout = 200; // timeout in milliseconds 1524 1525 icon.each(function(i) { 1526 if (i < active) { 1527 var time = (i + 1) * timeout; 1528 setTimeout(function() { 1529 1530 $(icon[i]).addClass('themebg'); 1531 1532 if( transparent ){ 1533 $(icon[i]).css('color', color); 1534 } else { 1535 $(icon[i]).css('background-color', color); 1536 } 1537 1538 }, time); 1539 } 1540 }); 1541 1542 if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { 1543 this.destroy(); 1544 } 1545 } 1546 } 1547 } 1548 }, 1549 { 1550 name: 'Animate Math | Counter, Quick Fact, etc.', 1551 location: '#Wrapper .animate-math .number', 1552 beforeActive: () => {}, 1553 afterActive: () => {}, 1554 settings: () => { 1555 return { 1556 offset: '100%', 1557 triggerOnce: true, 1558 handler: function() { 1559 var el = $(this.element).length ? $(this.element) : $(this); 1560 var duration = el.attr('data-duration') * 1 || Math.floor((Math.random() * 1000) + 1000); 1561 var thousands_separator = el.attr('data-thousands-separator') || 0; 1562 var to = el.attr('data-to'); 1563 1564 $({ 1565 property: 0 1566 }).animate({ 1567 property: to 1568 }, { 1569 duration: duration, 1570 easing: 'linear', 1571 step: function() { 1572 if( 'comma' == thousands_separator ){ 1573 el.text(Math.floor(this.property).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")) 1574 }
1574 else if( 'dot' == thousands_separator ){ 1575 el.text(Math.floor(this.property).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".")) 1576 } else if( 'space' == thousands_separator ){ 1577 el.text(Math.floor(this.property).toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ")) 1578 } else { 1579 el.text(Math.floor(this.property)); 1580 } 1581 }, 1582 complete: function() { 1583 if( 'comma' == thousands_separator ){ 1584 el.text(Math.floor(this.property).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")) 1585 } else if( 'dot' == thousands_separator ){ 1586 el.text(Math.floor(this.property).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".")) 1587 } else if( 'space' == thousands_separator ){ 1588 el.text(Math.floor(this.property).toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ")) 1589 } else { 1590 el.text(Math.floor(this.property)); 1591 } 1592 } 1593 }); 1594 1595 if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { 1596 this.destroy(); 1597 } 1598 } 1599 } 1600 } 1601 }, 1602 { 1603 name: 'Infinite Scroll | Blog & Portfolio', 1604 location: '.mfn-infinite-load-button', 1605 infiniteLoadButton: $('.mfn-infinite-load-button a'), 1606 beforeActive: () => {}, 1607 afterActive: ({infiniteLoadButton}) => { 1608 // Leave it, probably will be necessary soon. 1609 // const itemProvided = $('.column_portfolio').length ? '.column_portfolio' : '.column_blog'; 1610 1611 // $(`html, ${itemProvided}`).waypoint({ 1612 // handler: function(direction) { 1613 // infiniteScrollFunction($(location), infiniteLoadButton, direction); 1614 // }, 1615 // offset: 'bottom-in-view' 1616 // }); 1617 },
1618 settings: ({infiniteLoadButton, location}) => { 1619 return { 1620 handler: function(direction) { 1621 infiniteScrollFunction($(location), infiniteLoadButton, direction); 1622 }, 1623 offset: function(){ 1624 //after each load, calc the offset of element to know when posts should be loaded 1625 var offsetPosition = - ( ($(this)[0].element.scrollHeight) - (window.innerHeight / 1.2) ); 1626 return offsetPosition; 1627 } 1628 } 1629 } 1630 }, 1631 { 1632 name: 'Bars List', 1633 location: '.bars_list', 1634 beforeActive: () => {}, 1635 afterActive: ({infiniteLoadButton}) => {}, 1636 settings: () => { 1637 return { 1638 offset: '100%', 1639 triggerOnce: true, 1640 handler: function() { 1641 1642 var el = $(this.element).length ? $(this.element) : $(this); 1643 1644 el.addClass('hover'); 1645 1646 if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { 1647 this.destroy(); 1648 } 1649 } 1650 } 1651 } 1652 } 1653 ] 1654 } 1655 1656 1657 runWaypoints(){ 1658 const waypoints = this.getList; 1659 1660 waypoints.map(item => { 1661 if( $(item.location).length ) { 1662 // HOOK, before waypoints binding 1663 item.beforeActive(item) 1664 1665 // waypoints init 1666 queueMicrotask(() => $(item.location).waypoint(item.settings( item )) ); 1667 1668 // HOOK, after waypoints binding 1669 item.afterActive(item); 1670 } 1671 }) 1672 } 1673 } 1674 1675 const mfnWaypoints = new Waypoints; 1676 mfnWaypoints.runWaypoints(); 1677 1678 $(document).on('mfn:waypoints', function() { 1679 mfnWaypoints.runWaypoints(); 1680 }) 1681 1682 /** 1683 * Header template 1684 */ 1685 1686 if( $('.promo_bar_slider').length ){ 1687 promoBarSlider(); 1688 } 1689 1690 if( $('.mfn-looped-items-slider').length ){ 1691 queryLoopSlider(); 1692 } 1693 1694 headerTemplate.init(); 1695 footerTemplate.init(); 1696 bannerBox.init(); 1697 1698 mfnSideMenu.init(); 1699 mfnReadMore.init(); 1700 1701 if( $('.mfn-menu-item-megamenu').length ){ 1702 headerMegamenu.init(); 1703 } 1704 1705 // topBarTop = parseInt($('#Top_bar').css('top'), 10); 1706 // if (topBarTop < 0) topBarTop = 61; 1707 // topBarTop = topBarTop + 'px'; 1708 1709 /** 1710 * Sticky | Sidebar 1711 */ 1712 1713 function sidebarSticky() { 1714 1715 var spacing = fixStickyHeaderH(); 1716 1717 if( ! mfn.sidebarSticky ){ 1718 return false; 1719 } 1720 1721 if( $('.woocommerce-store-notice').length ){ 1722 spacing += $('.woocommerce-store-notice').outerHeight() || 0; 1723 } 1724 1725 sidebar = $('.mcb-sidebar .widget-area').stickySidebar({ 1726 topSpacing: spacing 1727 }); 1728 1729 } 1730 1731 sidebarSticky(); 1732 1733 $(window).on('debouncedresize', function() { 1734 1735 if( $(window).width() < 767 ){ 1736 screen = 'mobile'; 1737 }else if($(window).width() < 959){ 1738 screen = 'tablet'; 1739 }else if($(window).width() > 960){ 1740 screen = 'desktop'; 1741 } 1742 1743 bannerBox.init(); 1744 1745 newWidth = $(window).width(); 1746 1747 if( newWidth != currWidth ){ 1748 currWidth = $(window).width(); 1749 headerTemplate.init(); 1750 footerTemplate.init(); 1751 } 1752 1753 // stickyWrap.reset(); 1754 1755 if( $(window).width() < 767 && !$('.mfn-off-canvas-sidebar').length ){ 1756 offCanvasSidebar.mobile(); 1757 }else{ 1758 $('html').removeClass('mfn-ofcs-opened'); 1759 } 1760 1761 }); 1762 1763 /** 1764 * Menu | Overlay 1765 */ 1766 1767 $('.overlay-menu-toggle').on('click',function(e) { 1768 e.preventDefault(); 1769 1770 $(this).toggleClass('focus'); 1771 $('#Overlay').stop(true, true).fadeToggle(500); 1772 1773 var menuH = $('#Overlay nav').height() || 0; 1774 menuH = menuH / 2; 1775 1776 $('#Overlay nav').css('margin-top', '-' + menuH + 'px'); 1777 }); 1778 1779 $('#Overlay').on('click', '.menu-item > a', function() { 1780 $('.overlay-menu-toggle').trigger('click'); 1781 }); 1782 1783 $( '.header-overlay' ).on( 'keydown', function(event) { 1784 if ( 27 == event.keyCode ) { 1785 $('.overlay-menu-toggle.focus').trigger('click'); 1786 } 1787 }); 1788 1789 /** 1790 * Menu | Responsive | button 1791 */ 1792 1793 $('.responsive-menu-toggle').on('click', function(e) { 1794 e.preventDefault(); 1795 1796 var el = $(this); 1797 var menu = $('#Top_bar #menu'); 1798 var menuWrap = menu.closest('.top_bar_left'); 1799 1800 el.toggleClass('active'); 1801 1802 // sticky menu button 1803 if (el.hasClass('is-sticky') && el.hasClass('active') && (window.innerWidth < 768)) { 1804 1805 var top = 0; 1806 if (menuWrap.length) { 1807 top = menuWrap.offset().top - adminBarH(); 1808 } 1809 $('body,html').animate({ 1810 scrollTop: top 1811 }, 200); 1812 1813 } 1814 1815 menu.stop(true, true).slideToggle(200); 1816 }); 1817 1818 // close menu after link click 1819 1820 $('#Top_bar #menu').on('click', 'a:not(.menu-toggle)', function(){ 1821 var $menuButton = $('.responsive-menu-toggle.active'); 1822 1823 if( $menuButton.length ){ 1824 setTimeout(function(){ 1825 $menuButton.trigger('click'); 1826 },300); 1827 } 1828 1829 }); 1830 1831 1832 /** 1833 * Menu | Responsive | Side Slide 1834 */ 1835 1836 function sideSlide() { 1837 1838 //if( $('body').hasClass('mfn-header-template') ) return; 1839 1840 var slide = $('#Side_slide');
1841 var overlay = $('#body_overlay'); 1842 var ssMobileInitW = mobileInitW; 1843 var pos = 'right'; 1844 1845 var shiftSlide = -slide.data('width'); 1846 var shiftBody = shiftSlide / 2; 1847 1848 // constructor 1849 1850 var constructor = function() { 1851 if (!slide.hasClass('enabled')) { 1852 1853 $('nav#menu').detach().appendTo('#Side_slide .menu_wrapper'); 1854 slide.addClass('enabled'); 1855 1856 } 1857 }; 1858 1859 // destructor 1860 1861 var destructor = function() { 1862 if (slide.hasClass('enabled')) { 1863 1864 close(); 1865 $('nav#menu').detach().prependTo('#Top_bar .menu_wrapper'); 1866 slide.removeClass('enabled'); 1867 1868 } 1869 }; 1870 1871 // reload 1872 1873 var reload = function() { 1874 1875 if ( window.innerWidth < ssMobileInitW ) { 1876 constructor(); 1877 } else if( $('body').hasClass('header-shop') ) { 1878 if ($('#Top_bar').hasClass('is-sticky')) { 1879 $(document).trigger('mfn:header:sticky:on'); 1880 } else { 1881 $(document).trigger('mfn:header:sticky:off'); 1882 } 1883 } else { 1884 destructor(); 1885 } 1886 1887 }; 1888 1889 // init 1890 1891 var init = function() { 1892 1893 if (slide.hasClass('left')) { 1894 pos = 'left'; 1895 } 1896 1897 // responsive off 1898 if ($('body').hasClass('responsive-off')) { 1899 ssMobileInitW = 0; 1900 } 1901 1902 // header simple 1903 if ($('body').hasClass('header-simple')) { 1904 ssMobileInitW = 9999; 1905 } 1906 1907 // header style: shop | top bar is sticky 1908 if ($('#Top_bar').hasClass('is-sticky')) { 1909 $(document).trigger('mfn:header:sticky:on'); 1910 } 1911 1912 reload(); 1913 }; 1914 1915 // reset to default 1916 1917 var reset = function(time) { 1918 1919 $('.lang-active.active', slide).removeClass('active').children('i').attr('class', 'icon-down-open-mini'); 1920 $('.lang-wrapper', slide).fadeOut(0); 1921 1922 $('.icon.search.active', slide).removeClass('active'); 1923 $('.search-wrapper', slide).fadeOut(0); 1924 1925 $('.menu_wrapper, .social', slide).fadeIn(time); 1926 1927 }; 1928 1929 // menu button 1930 1931 var button = function() { 1932 1933 // show 1934 1935 if (pos == 'left') { 1936 slide.animate({ 1937 'left': 0 1938 }, 300); 1939 $('body').animate({ 1940 'right': shiftBody 1941 }, 300); 1942 } else { 1943 slide.animate({ 1944 'right': 0 1945 }, 300); 1946 $('body').animate({ 1947 'left': shiftBody 1948 }, 300); 1949 } 1950 1951 overlay.fadeIn(300); 1952 1953 $('body').addClass('side-slide-is-open'); 1954 1955 // reset 1956 1957 reset(0); 1958 1959 }; 1960 1961 // close 1962 1963 var close = function() { 1964 1965 if (pos == 'left') { 1966 slide.animate({ 1967 'left': shiftSlide 1968 }, 300); 1969 $('body').animate({ 1970 'right': 0 1971 }, 300); 1972 } else { 1973 slide.animate({ 1974 'right': shiftSlide 1975 }, 300); 1976 $('body').animate({ 1977 'left': 0 1978 }, 300); 1979 } 1980 1981 overlay.fadeOut(300); 1982 1983 $('body').removeClass('side-slide-is-open'); 1984 1985 /* Just to be sure, change aria. */ 1986 if ( $('body').hasClass('keyboard-support') ) { 1987 $('#Side_slide').attr('aria-expanded', 'false'); 1988 } 1989 1990 // if page contains revolution slider, trigger resize 1991 1992 if ($('rs-module').length) { 1993 setTimeout(function() { 1994 $(window).trigger('resize'); 1995 redrawAllRevolutionSliders(); 1996 }, 310); 1997 } 1998 1999 }; 2000 2001 // search 2002 2003 $('.icon.search', slide).on('click', function(e) { 2004 2005 e.preventDefault(); 2006 2007 var el = $(this); 2008 2009 if (el.hasClass('active')) { 2010 2011 $('.search-wrapper', slide).fadeOut(0); 2012 $('.menu_wrapper, .social', slide).fadeIn(300); 2013 2014 } else { 2015 2016 $('.search-wrapper', slide).fadeIn(300); 2017 $('.menu_wrapper, .social', slide).fadeOut(0); 2018 2019 $('.lang-active.active', slide).removeClass('active').children('i').attr('class', 'icon-down-open-mini'); 2020 $('.lang-wrapper', slide).fadeOut(0); 2021 2022 } 2023 2024 el.toggleClass('active'); 2025 }); 2026 2027 // search form submit 2028 2029 $('a.submit', slide).on('click', function(e) { 2030 e.preventDefault(); 2031 $('#side-form').submit(); 2032 }); 2033 2034 // lang menu 2035 2036 $('.lang-active', slide).on('click', function(e) { 2037 e.preventDefault(); 2038 2039 var el = $(this); 2040 2041 if (el.hasClass('active')) { 2042 2043 $('.lang-wrapper', slide).fadeOut(0); 2044 $('.menu_wrapper, .social', slide).fadeIn(300); 2045 el.children('i').attr('class', 'icon-down-open-mini'); 2046 2047 } else { 2048 2049 $('.lang-wrapper', slide).fadeIn(300); 2050 $('.menu_wrapper, .social', slide).fadeOut(0); 2051 el.children('i').attr('class', 'icon-up-open-mini'); 2052 2053 $('.icon.search.active', slide).removeClass('active'); 2054 $('.search-wrapper', slide).fadeOut(0); 2055 2056 } 2057 2058 el.toggleClass('active'); 2059 }); 2060 2061 // bind --- 2062 2063 // click | menu button 2064 2065 $('.responsive-menu-toggle').off('click'); 2066 2067 $('.responsive-menu-toggle').on('click', function(e) { 2068 e.preventDefault(); 2069 button(); 2070 }); 2071 2072 // click | close 2073 2074 overlay.on('click', function(e) { 2075 close(); 2076 }); 2077 2078 $('.close', slide).on('click', function(e) { 2079 e.preventDefault(); 2080 close(); 2081 }); 2082 2083 $(slide).on('click', '.menu_wrapper a:not(.menu-toggle), .action_button', function(e) { 2084 2085 if( $(this).hasClass('mega-menu-link') ){ 2086 return; // FIX: plugin maxmegamenu 2087 } 2088 2089 if( '#' == $(this).attr('href') ){ 2090 e.preventDefault(); 2091 return; 2092 } 2093 2094 setTimeout(function(){ 2095 close(); 2096 },500); 2097 2098 }); 2099 2100 // click | below search or languages menu 2101 2102 $(slide).on('click', function(e) { 2103 if ($(e.target).is(slide)) { 2104 reset(300); 2105 } 2106 }); 2107 2108 // debouncedresize 2109 2110 $(window).on('debouncedresize', reload); 2111 2112 // header style: shop | sticky 2113 2114 if( $('body').hasClass('header-shop') ){ 2115 2116 $(document).on('mfn:header:sticky:on', function(){ 2117 if( window.innerWidth >= ssMobileInitW ){ 2118 $('#Top_bar .menu_wrapper').css('min-height', '70px'); 2119 constructor(); 2120 } 2121 }); 2122 2123 $(document).on('mfn:header:sticky:off', function(){ 2124 if( window.innerWidth >= ssMobileInitW ){ 2125 destructor(); 2126 } 2127 }); 2128 2129 } 2130 2131 // init 2132 2133 init(); 2134 2135 } 2136 2137 if ($('body').hasClass('mobile-side-slide')) { 2138 sideSlide(); 2139 } 2140 2141 /** 2142 * Gallery | WordPress Gallery 2143 */ 2144 2145 // WordPress <= 4.9 | content 2146 2147 msnryGalleryInit(); 2148 2149 // WordPress >
2149= 5.0 | content 2150 2151 $('.sections_group .wp-block-gallery').each(function(index) { 2152 2153 var el = $(this); 2154 var link = $('.blocks-gallery-item a, .wp-block-image a', el); 2155 2156 // lightbox | link to media file 2157 2158 if ((/\.(gif|jpg|jpeg|png)$/i).test(link.attr('href'))) { 2159 link.attr('rel', 'prettyphoto[wp5-gallery-' + index + ']'); 2160 } 2161 2162 }); 2163 2164 // widgets 2165 2166 $('.widget_media_gallery .gallery').each(function() { 2167 2168 var el = $(this); 2169 var id = el.attr('id'); 2170 2171 // lightbox | link to media file 2172 2173 $('.gallery-icon a', el).attr('rel', 'prettyphoto[widget-' + id + ']'); 2174 2175 }); 2176 2177 /** 2178 * Lightbox | PrettyPhoto 2179 */ 2180 2181 $('a[rel^="prettyphoto[portfolio]"]').each(function() { 2182 2183 var el = $(this); 2184 var parent = el.closest('.column'); 2185 var index = $('.column').index(parent); 2186 2187 el.attr('rel', 'prettyphoto[portfolio-' + index + ']'); 2188 2189 }); 2190 2191 // FIX: elementor + single product | disable duplicated futured image lightbox 2192 2193 $('.elementor-page .woocommerce-product-gallery .woocommerce-product-gallery__image a').attr('href',''); 2194 2195 /** 2196 * Helper function to ensure the alt attribute value is safely handled 2197 */ 2198 2199 function escapeHtml(text) { 2200 2201 if ( ! text ) return ''; 2202 2203 const map = { 2204 '&': '&', 2205 '<': '<', 2206 '>': '>', 2207 '"': '"', 2208 "'": ''' 2209 }; 2210 2211 return text.replace(/[&<>"']/g, function(m) { return map[m]; }); 2212 } 2213 2214 /** 2215 * Lightbox | Magnific Popup 2216 * with prettyPhoto backward compatibility 2217 */ 2218 2219 function lightbox() { 2220 2221 var galleries = []; 2222 2223 // init 2224 2225 var init = function() { 2226 2227 if (lightboxAttr) { 2228 compatibility(); 2229 setType(); 2230 constructor(); 2231 } 2232 2233 }; 2234 2235 // backward compatibility for prettyPhoto 2236 2237 var compatibility = function() { 2238 2239 $('a[rel^="prettyphoto"], a.prettyphoto, a[rel^="prettyphoto"]').each(function() { 2240 2241 var el = $(this); 2242 var rel = el.attr('rel'); 2243 2244 if (rel) { 2245 rel = rel.replace('prettyphoto', 'lightbox'); 2246 } else { 2247 rel = 'lightbox'; 2248 } 2249 2250 el.removeClass('prettyphoto').attr('rel', rel); 2251 2252 }); 2253 2254 }; 2255 2256 // check if item is a part of gallery 2257 2258 var isGallery = function(rel) { 2259 2260 if (!rel) { 2261 return false; 2262 } 2263 2264 var regExp = /\[(?:.*)\]/; 2265 var gallery = regExp.exec(rel); 2266 2267 if (gallery) { 2268 gallery = gallery[0]; 2269 gallery = gallery.replace('[', '').replace(']', ''); 2270 return gallery; 2271 } 2272 2273 return false; 2274 }; 2275 2276 // set array of names of galleries 2277 2278 var setGallery = function(gallery) { 2279 2280 if (galleries.indexOf(gallery) == -1) { 2281 galleries.push(gallery); 2282 return true; 2283 } 2284 2285 return false; 2286 }; 2287 2288 // get file type by link 2289 2290 var getType = function(src) { 2291 2292 if (src.match(/youtube\.com\/watch/i) || src.match(/youtube\.com\/embed/i) || src.match(/youtu\.be/i)) { 2293 return 'iframe'; 2294 2295 } else if (src.match(/youtube-nocookie\.com/i)) { 2296 return 'iframe'; 2297 2298 } else if (src.match(/vimeo\.com/i)) { 2299 return 'iframe'; 2300 2301 } else if (src.match(/\biframe=true\b/i)) { 2302 return 'ajax'; 2303 2304 } else if (src.match(/\bajax=true\b/i)) { 2305 return 'ajax'; 2306 2307 } else if (src.match(/\.mp4/i)) { 2308 return 'mp4'; 2309 2310 } else if (src.substr(0, 1) == '#') { 2311 return 'inline'; 2312 2313 } else { 2314 return 'image'; 2315 2316 } 2317 }; 2318 2319 // set file type 2320 2321 var setType = function() { 2322 2323 $('a[rel^="lightbox"]').each(function() { 2324 2325 var el = $(this); 2326 var href = el.attr('href'); 2327 var rel = el.attr('rel'); 2328 2329 // FIX: WPBakery Page Builder duplicated lightbox 2330 if ( el.closest('.wpb_column').length ){ 2331 // return true; 2332 } 2333 2334 if (href) { 2335 2336 // gallery 2337 2338 var gallery = isGallery(rel); 2339 2340 if (gallery) { 2341 el.attr('data-lightbox-type', 'gallery'); 2342 setGallery(gallery); 2343 return true; 2344 } 2345 2346 el.attr('data-lightbox-type', getType(href)); 2347 2348 // iframe paremeters 2349 2350 if (getType(href) == 'iframe') { 2351 el.attr('href', href.replace('&rel=0', '')); 2352 } 2353 } 2354 2355 }); 2356 2357 }; 2358 2359 // constructor 2360 2361 var constructor = function() { 2362 2363 // Dividing plugins into separate files fix 2364 if( !galleries.length 2365 && !$('a[rel^="lightbox"][data-lightbox-type="image"]').length 2366 && !$('a[rel^="lightbox"][data-lightbox-type="iframe"]').length 2367 && !$('a[rel^="lightbox"][data-lightbox-type="inline"]').length 2368 && !$('a[rel^="lightbox"][data-lightbox-type="mp4"]').length 2369 && !$('a[rel^="pdf-lightbox"]').length 2370 ) return; 2371 2372 var attr = { 2373 autoFocusLast: false, 2374 removalDelay: 160, 2375 image: { 2376 titleSrc: function(item) { 2377 var img = item.el.closest('.image_wrapper, li').find('img').first(); 2378 if (lightboxAttr.title && img.length) { 2379 return escapeHtml( img.attr('alt') ); 2380 } else { 2381 return false;
2382 } 2383 } 2384 } 2385 }; 2386 2387 // image 2388 2389 $('a[rel^="lightbox"][data-lightbox-type="image"]').magnificPopup({ 2390 autoFocusLast: attr.autoFocusLast, 2391 removalDelay: attr.removalDelay, 2392 type: 'image', 2393 image: attr.image 2394 }); 2395 2396 // iframe | video 2397 2398 $('a[rel^="lightbox"][data-lightbox-type="iframe"]').magnificPopup({ 2399 autoFocusLast: attr.autoFocusLast, 2400 removalDelay: attr.removalDelay, 2401 type: 'iframe', 2402 iframe: { 2403 patterns: { 2404 youtube: { 2405 index: 'youtube.com/', 2406 id: 'v=', 2407 src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0' 2408 }, 2409 youtu_be: { 2410 index: 'youtu.be/', 2411 id: '/', 2412 src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0' 2413 }, 2414 nocookie: { 2415 index: 'youtube-nocookie.com/embed/', 2416 id: '/', 2417 src: '//www.youtube-nocookie.com/embed/%id%?autoplay=1&rel=0' 2418 } 2419 } 2420 } 2421 }); 2422 2423 // iframe | mp4 2424 2425 $('a[rel^="lightbox"][data-lightbox-type="mp4"]').magnificPopup({ 2426 autoFocusLast: attr.autoFocusLast, 2427 removalDelay: attr.removalDelay, 2428 type: 'iframe', 2429 iframe: { 2430 markup: '<div class="mfp-mp4 popup-content">'+ 2431 '<video controls mute autoplay>'+ 2432 '<source class="mfp-source" type="video/mp4">'+ 2433 '</video>'+ 2434 '<div class="mfp-close"></div>'+ 2435 '</div>', 2436 patterns: { 2437 mp4: { 2438 src: '%id%', 2439 } 2440 }, 2441 srcAction: 'source_src', 2442 } 2443 }); 2444 2445 // pdf 2446 2447 $('a[rel^="pdf-lightbox"]').magnificPopup({ 2448 autoFocusLast: attr.autoFocusLast, 2449 removalDelay: attr.removalDelay, 2450 type: 'iframe' 2451 }); 2452 2453 // inline 2454 2455 $('a[rel^="lightbox"][data-lightbox-type="inline"]').magnificPopup({ 2456 autoFocusLast: attr.autoFocusLast, 2457 type: 'inline', 2458 midClick: true, 2459 callbacks: { 2460 open: function() { 2461 $('.mfp-content').children().addClass('mfp-inline') 2462 2463 // lazy load video and autoplay 2464 // $('.mfp-content').find('source').each(function(){ 2465 // $(this).attr('src', $(this).attr('data-src') ); 2466 // $(this).parent('video').get(0).load(); 2467 // $(this).parent('video').get(0).play(); 2468 // }); 2469 2470 }, 2471 beforeClose: function() { 2472 $('.mfp-content').children().removeClass('mfp-inline'); 2473 } 2474 } 2475 }); 2476 2477 // gallery 2478 2479 for (var i = 0, len = galleries.length; i < len; i++) { 2480 2481 var gallery = '[' + galleries[i] + ']'; 2482 gallery = 'a[rel^="lightbox' + gallery + '"]:visible'; 2483 2484 $(gallery).magnificPopup({ 2485 autoFocusLast: attr.autoFocusLast, 2486 removalDelay: attr.removalDelay, 2487 type: 'image', 2488 image: attr.image, 2489 gallery: { 2490 enabled: true, 2491 tCounter: '%curr% / %total%' // markup of counter 2492 } 2493 2494 }); 2495 2496 } 2497 2498 // FIX: elementor | disable in Elementor wrapper 2499 2500 $('.elementor-page a[rel^="lightbox"]:not(.popup-link):not(.rs-layer):not([data-lightbox-type="iframe"])').off('click'); 2501 2502 // FIX: WPBakery | disable if WPBakery lighbox is active 2503 2504 setTimeout(function(){ 2505 2506 var $doc = $('body'); 2507 var $events = $._data($doc[0],"events"); 2508 2509 if($events && $events.click){ 2510 for(var i=$events.click.length-1; i>=0; i--){ 2511 var handler = $events.click[i]; 2512 if( handler && handler.selector && handler.selector.indexOf('lightbox') !== -1 ){ 2513 $('.wpb_column a[rel^="lightbox"]:not(.popup-link)').off('click'); 2514 } 2515 } 2516 } 2517 2518 },0); 2519 2520 }; 2521 2522 // reload 2523 2524 var reload = function() { 2525 2526 $('a[rel^="lightbox"]').off('click'); 2527 constructor(); 2528 2529 }; 2530 2531 // init 2532 2533 init(); 2534 2535 // isotope:arrange 2536 2537 mfnIsotope.addEventListener('arrange', reload); 2538 2539 // ajaxComplete 2540 2541 $(document).ajaxComplete(function() { 2542 reload(); 2543 }); 2544 2545 } 2546 2547 lightbox(); 2548 2549 $(document).on('mfnPopupInit', function() { 2550 lightbox(); 2551 }); 2552 2553 $(document).on('mfn:tabber:open', function() { 2554 lightbox(); 2555 }); 2556 2557 /** 2558 * Menu | mfnMenu 2559 */ 2560 2561 function mainMenu() { 2562 2563 var mmMobileInitW = mobileInitW; 2564 2565 if ($('body').hasClass('header-simple') || $('#Header_creative.dropdown').length) { 2566 mmMobileInitW = 9999; 2567 } 2568 2569 $('#menu > ul.menu').mfnMenu({ 2570 addLast: true, 2571 arrows: true, 2572 mobileInit: mmMobileInitW, 2573 responsive: mfn.responsive 2574 }); 2575 2576 $('#secondary-menu > ul.secondary-menu').mfnMenu({ 2577 mobileInit: mmMobileInitW, 2578 responsive: mfn.responsive 2579 }); 2580 2581 } 2582 2583 mainMenu(); 2584 2585 /** 2586 * Menu | NOT One Page | .scroll item 2587 * Works with .scroll class 2588 * Since 4.8 replaced with: Page Options > One Page | function: onePageMenu() 2589 */ 2590 2591 function onePageScroll() { 2592 if (!$('body').hasClass('one-page')) { 2593 var menu = $('#menu'); 2594 2595 if (menu.find('li.scroll').length > 1) { 2596 menu.find('li.current-menu-item:not(:first)').removeClass('current-menu-item currenet-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor'); 2597 2598 // menu item click 2599 menu.on('click','a',function() { 2600 $(this).closest('li').siblings('li').removeClass('current-menu-item currenet-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor'); 2601 $(this).closest('li').addClass('current-menu-item'); 2602 }); 2603 } 2604 } 2605 } 2606 onePageScroll(); 2607 2608 /** 2609 * Menu | One Page | Active on Scroll & Click 2610 */ 2611 2612 function onePageMenu() { 2613 if ($('body').hasClass('one-page')) { 2614 2615 var menu = $('#menu'); 2616 if( $('#mfn-header-template').length ) menu = $('#mfn-header-template .mfn-header-menu'); 2617 2618 // add attr [data-hash] & [data-id] 2619 2620 $('a[href]', menu).each(function() { 2621 2622 var url = $(this).attr('href'); 2623 if (url && url.split('#')[1]) { 2624 2625 // data-hash 2626 var hash = '#' + url.split('#')[1]; 2627 if (hash && $(hash).length) { 2628 // check if element with specified ID exists 2629 $(this).attr('data-hash', hash); 2630 $(hash).attr('data-id', hash); 2631 } 2632 2633 // Visual Composer 2634 var vcHash = '#' + url.split('#')[1]; 2635 var vcClass = '.vc_row.' + url.split('#')[1]; 2636 if (vcClass && $(vcClass).length) { 2637 // check if element with specified Class exists 2638 $(this).attr('data-hash', vcHash); 2639 $(vcClass).attr('data-id', vcHash); 2640 } 2641 2642 } 2643 2644 }); 2645 2646 // active 2647 2648 var hash; 2649 var activeSelector = 'li.current-menu-item, li.current-menu-parent, li.current-menu-ancestor, li.current-page-ancestor, li.current_page_item, li.current_page_parent, li.current_page_ancestor'; 2650 var activeClasses = 'current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor'; 2651 2652 if ($(activeSelector, menu).length) { 2653 2654 // remove duplicated 2655 $(activeSelector, menu) 2656 .not(':first').removeClass(activeClasses); 2657 2658 // remove if 1st link to section & section is not visible 2659 hash = $(activeSelector, menu).find('a[data-hash]').attr('data-hash'); 2660 2661 if (hash) { 2662 hash = '[data-id="' + hash + '"]'; 2663 2664 if ($(hash).length && $(hash).visible(true)) { 2665 // do nothing 2666 } else { 2667 $(activeSelector, menu).removeClass('current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor') 2668 .closest('li').removeClass('current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor'); 2669 } 2670 } else { 2671 // do nothing 2672 } 2673 2674 } else { 2675 2676 // add to first if none is active 2677 var first = $('li:first-child', menu); 2678 var firstA = first.children('a'); 2679 2680 if (firstA.attr('data-hash')) { 2681 hash = firstA.attr('data-hash'); 2682 hash = '[data-id="' + hash + '"]'; 2683 2684 if ($(hash).length && ($(hash).offset().top == adminBarH())) { 2685 first.addClass('current-menu-item'); 2686 } 2687 } 2688 2689 } 2690 2691 // click 2692 2693 var menu_item = $('#menu a[data-hash]'); 2694 if( $('#mfn-header-template').length ) menu_item = $('#mfn-header-template .mfn-header-menu a[data-hash]'); 2695 2696 menu_item.on('click', function(e) { 2697 e.preventDefault(); // only with: body.one-page 2698 2699 if( $('html').hasClass('mfn-header-tmpl-burger-sidebar-opened') ){ 2700 $('html').removeClass('mfn-header-tmpl-burger-sidebar-opened scrollbar-hidden'); 2701 } 2702 2703 // active 2704 2705 menu.find('li').removeClass('current-menu-item'); 2706 $(this) 2707 .closest('li').addClass('current-menu-item') 2708 .closest('.menu > li').addClass('current-menu-item'); 2709 2710 var hash = $(this).attr('data-hash'); 2711 hash = '[data-id="' + hash + '"]'; 2712 2713 // mobile - sticky header - close menu 2714 2715 if ( window.innerWidth < 768 ) { 2716 $('.responsive-menu-toggle').removeClass('active'); 2717 $('#Top_bar #menu').hide(); 2718 } 2719 2720 // offset 2721 2722 var headerFixedAbH = $('.header-fixed.ab-show #Action_bar').innerHeight() || 0; 2723 var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight() || 0; 2724 2725 var offset = headerFixedAbH + tabsHeaderH + adminBarH(); 2726 2727 // sticky height 2728 2729 var stickyH = fixStickyHeaderH(); 2730 2731 // FIX | Header below | 1st section 2732 if ($('body').hasClass('header-below') && $('#Content').length) { 2733 if ($(hash).offset().top < ($('#Content').offset().top + 60)) { 2734 stickyH = -1; 2735 } 2736 } 2737 2738 // animate scroll 2739 2740 $('html, body').animate({
2741 scrollTop: $(hash).offset().top - offset - stickyH 2742 }, 500); 2743 2744 if($(this).closest('.column_header_burger').length ){ 2745 //$(this).closest('.column_header_burger').find('.mfn-header-menu-toggle').trigger('click'); 2746 $('body').trigger('click'); 2747 } 2748 2749 2750 }); 2751 2752 } 2753 } 2754 onePageMenu(); 2755 2756 /** 2757 * Header | Creative 2758 */ 2759 2760 var cHeader = 'body:not( .header-open ) #Header_creative', 2761 cHeaderEl = $(cHeader), 2762 cHeaderCurrnet; 2763 2764 function creativeHeader() { 2765 2766 $('.creative-menu-toggle').on('click', function(e) { 2767 e.preventDefault(); 2768 2769 cHeaderEl.addClass('active'); 2770 $('.creative-menu-toggle, .creative-social', cHeaderEl).fadeOut(500); 2771 $('#Action_bar', cHeaderEl).fadeIn(500); 2772 2773 }); 2774 2775 } 2776 creativeHeader(); 2777 2778 $(document).on('mouseenter', cHeader, function() { 2779 cHeaderCurrnet = 1; 2780 }); 2781 2782 $(document).on('mouseleave', cHeader, function() { 2783 cHeaderCurrnet = null; 2784 setTimeout(function() { 2785 if (!cHeaderCurrnet) { 2786 2787 cHeaderEl.removeClass('active'); 2788 $('.creative-menu-toggle, .creative-social', cHeaderEl).fadeIn(500); 2789 $('#Action_bar', cHeaderEl).fadeOut(500); 2790 2791 } 2792 }, 1000); 2793 }); 2794 2795 // Fix: Header Creative & Mobile Sticky | On Resize > 768 px 2796 function creativeHeaderFix() { 2797 if ( $('body').hasClass('header-creative') && window.innerWidth >= 768 ) { 2798 if ($('#Top_bar').hasClass('is-sticky')) { 2799 $('#Top_bar').removeClass('is-sticky'); 2800 } 2801 } 2802 } 2803 2804 /** 2805 * Header | Menu Burger 2806 */ 2807 2808 $(document).on("click", ".mfn-header-tmpl .mfn-header-menu-toggle", function(e) { 2809 e.preventDefault(); 2810 2811 if( $(this).closest('.mcb-column').hasClass('mfn-header-tmpl-menu-active') ){ 2812 $(document).unbind('click', hideSidebarTmplBurger); 2813 $(this).closest('.mcb-column').removeClass('mfn-header-tmpl-menu-active'); 2814 removeBringToFront(); 2815 if( $('.mfn-header-tmpl-classic-menu').length ) $('.mfn-header-tmpl-classic-menu').remove(); 2816 $(this).closest('.mcb-column-inner').find('.mfn-header-tmpl-menu-sidebar').attr('aria-expanded', false); 2817 2818 $('html').removeClass('mfn-header-tmpl-burger-sidebar-opened scrollbar-hidden'); 2819 }else{ 2820 $(document).bind('click', hideSidebarTmplBurger); 2821 $(this).closest('.mcb-column').addClass('mfn-header-tmpl-menu-active'); 2822 $(this).closest('.mcb-column').addClass('mfn-bring-to-front'); 2823 $(this).closest('.mcb-wrap').addClass('mfn-bring-to-front'); 2824 $(this).closest('.mcb-section').addClass('mfn-bring-to-front'); 2825 $(this).closest('.mcb-column-inner').find('.mfn-header-tmpl-menu-sidebar').attr('aria-expanded', true); 2826 2827 if( $(this).closest('.mcb-column-inner').find('.mfn-header-classic-mobile-menu').length ){ 2828 var offset_top = $(this).closest('.section').offset().top + $(this).closest('.section').outerHeight() - $(window).scrollTop(); 2829 2830 $('body').append('<style class="mfn-header-tmpl-classic-menu">.mfn-header-tmpl-menu-sidebar.mfn-header-classic-mobile-menu{ top: '+offset_top+'px; max-height: '+($(window).height() - offset_top)+'px} .column_header_burger.mfn-header-tmpl-menu-active:before{ top: '+offset_top+'px; max-height: '+($(window).height() - offset_top)+'px}</style>'); 2831 //$(this).closest('.mcb-column-inner').find('.mfn-header-classic-mobile-menu').css({'top': offset_top, 'max-height': $(window).height() - offset_top}); 2832 } 2833 2834 $('html').addClass('mfn-header-tmpl-burger-sidebar-opened'); 2835 2836 var htmlW = $('html').width(); 2837 2838 if( $('html').width() != htmlW ){ 2839 $('html').addClass('scrollbar-hidden'); 2840 } 2841 } 2842 2843 }); 2844 2845 $(document).on("click", ".mfn-header-tmpl-menu-sidebar .mfn-header-menu .mfn-menu-li a", function (e) { 2846 2847 if( $(this).closest('#mfn-header-template').length ) return; // The header has its own functionality 2848 2849 const $a = $(this); 2850 const href = $a.attr("href") || ""; 2851 const $html = $("html"); 2852 const $header = $(".mfn-header-tmpl.mfn-header-main"); 2853 2854 // Case: exactly "#" 2855 if (href === "#") { 2856 e.preventDefault(); 2857 $a.closest("li").toggleClass("current-menu-item"); 2858 return; 2859 } 2860 2861 let hash = ""; 2862 const hashIndex = href.indexOf("#"); 2863 if (hashIndex !== -1) hash = href.slice(hashIndex + 1); 2864 2865 if (!hash) return; 2866 2867 const $target = $("#" + CSS.escape(hash)); 2868 if (!$target.length) return; 2869 2870 e.preventDefault(); 2871
2872 const isFixedOrSticky = 2873 $header.hasClass("mfn-header-tmpl-fixed") || $header.hasClass("mfn-hasSticky"); 2874 const headerH = isFixedOrSticky ? $header.outerHeight() : 0; 2875 2876 const $li = $a.closest("li"); 2877 $li.closest("ul").find("li.current-menu-item").removeClass("current-menu-item"); 2878 $li.addClass("current-menu-item"); 2879 2880 const scrollOffset = $target.offset().top - headerH; 2881 $("html, body").stop(true).animate({ scrollTop: scrollOffset }, 500); 2882 2883 $(document).off("click", hideSidebarTmplBurger); 2884 $a.closest(".mcb-column").removeClass("mfn-header-tmpl-menu-active"); 2885 removeBringToFront(); 2886 2887 if ($html.hasClass("mfn-header-tmpl-burger-sidebar-opened")) { 2888 $html.removeClass("mfn-header-tmpl-burger-sidebar-opened scrollbar-hidden"); 2889 } 2890 } 2891 ); 2892 2893 2894 2895 $(document).on("click", ".mfn-off-canvas-sidebar .widget_nav_menu ul.menu li a", function(e) { 2896 let href = $(this).attr('href'); 2897 2898 if( $(href).length && href.startsWith("#") ) { 2899 e.preventDefault(); 2900 let header_h = 0; 2901 if( $('.mfn-header-tmpl.mfn-header-main').hasClass('mfn-header-tmpl-fixed') || $('.mfn-header-tmpl.mfn-header-main').hasClass('mfn-hasSticky') ){ 2902 header_h = $('.mfn-header-tmpl.mfn-header-main').outerHeight(); 2903 } 2904 $(this).closest('ul').find('li.current-menu-item').removeClass('current-menu-item'); 2905 $(this).closest('li').addClass('current-menu-item'); 2906 2907 let scroll_offset = $(href).offset().top - header_h; 2908 $('body, html').animate({ scrollTop: scroll_offset }, 500); 2909 if( $('html').hasClass('mfn-ofcs-opened') ){ 2910 $('html').removeClass('mfn-ofcs-opened'); 2911 } 2912 } 2913 }); 2914 2915 2916 function hideSidebarTmplBurger(e){ 2917 var div = $('.mfn-header-tmpl-menu-sidebar'); 2918 2919 if (!div.is(e.target) && div.has(e.target).length === 0){ 2920 $('.mfn-header-tmpl-menu-active').removeClass('mfn-header-tmpl-menu-active'); 2921 2922 div.attr('aria-expanded', 'false'); 2923 2924 $(document).unbind('click', hideSidebarTmplBurger); 2925 removeBringToFront(); 2926 if( $('.mfn-header-tmpl-classic-menu').length ) $('.mfn-header-tmpl-classic-menu').remove(); 2927 $('html').removeClass('mfn-header-tmpl-burger-sidebar-opened scrollbar-hidden'); 2928 } 2929 } 2930 2931 function removeBringToFront(){ 2932 if( $('.mfn-bring-to-front').length ) { 2933 $('.mfn-bring-to-front').removeClass('mfn-bring-to-front'); 2934 } 2935 } 2936 2937 /** 2938 * Header | Search 2939 */ 2940 2941 $(document).on("click", "body:not(.mfn-ui) .mfn-sidemenu-tmpl .mfn-searchbar-toggle, body:not(.mfn-ui) .mfn-header-tmpl .mfn-searchbar-toggle, .mfn-header-tmpl .search_wrapper .mfn-close-icon, .mfn-sidemenu-tmpl .search_wrapper .mfn-close-icon", function(e) { 2942 e.preventDefault(); 2943 2944 if( $(this).closest('.mcb-column-inner').hasClass('mfn-searchbar-active') ){ 2945 $(this).closest('.mcb-column-inner').removeClass('mfn-searchbar-active'); 2946 2947 $('html').removeClass('mfn-popup-browser-scroll-disabled'); 2948 $('body').removeClass('search-overlay-opened'); 2949 removeBringToFront(); 2950 }else{ 2951 $(this).closest('.mcb-column-inner').addClass('mfn-searchbar-active'); 2952 $(this).closest('.mcb-column').addClass('mfn-bring-to-front'); 2953 $(this).closest('.mcb-wrap').addClass('mfn-bring-to-front'); 2954 $(this).closest('.mcb-section').addClass('mfn-bring-to-front'); 2955 2956 if( $(this).closest('.mcb-column-inner').find('input.field').length ){ 2957 $(this).closest('.mcb-column-inner').find('input.field').focus(); 2958 } 2959 2960 if( $('body').hasClass('search-scroll-disable') ){ 2961 $('html').addClass('mfn-popup-browser-scroll-disabled'); 2962 } 2963 2964 $('body').addClass('search-overlay-opened'); 2965 } 2966 2967 }); 2968 2969 $(".search_button:not(.has-input), #Top_bar .icon_close").on('click', function(e) { 2970 e.preventDefault(); 2971 2972 if( $(this).closest('.mfn-header-tmpl').length ){ 2973 // header template 2974 $(this).closest('.mcb-column').toggleClass('mfn-searchbar-active'); 2975 2976 }else{ 2977 const search = $('.search_wrapper') 2978 if( search.css('display') === 'none' ){ 2979 search.fadeIn().find('.field').focus(); 2980 2981 if( $('body').hasClass('search-scroll-disable') ){ 2982 $('html').addClass('mfn-popup-browser-scroll-disabled'); 2983 } 2984 2985 $('body').addClass('search-overlay-opened'); 2986 2987 setTimeout(function(){ search.addClass('mfn-loaded') }, 300); 2988 } else{ 2989 search.fadeOut().removeClass('mfn-loaded'); 2990 2991 $('html').removeClass('mfn-popup-browser-scroll-disabled'); 2992 $('body').removeClass('search-overlay-opened'); 2993 } 2994 } 2995 2996 }); 2997 2998 $(document).on('keydown', function(e){ 2999 if (e.key === 'Escape' && $('.search_wrapper').is(':visible') && $('body').hasClass('search-overlay-opened')) { 3000 $('.search_wrapper .icon_close').trigger('click'); 3001 } 3002 }); 3003 3004 /** 3005 * WPML | Language switcher in the WP Menu 3006 */ 3007 3008 function mfnWPML() { 3009 $('#menu .menu-item-language:not(.menu-item-language-current)').each(function() { 3010 var el = $(this).children('a'); 3011 3012 if (!el.children('span:not(.icl_lang_sel_bracket)').length) { 3013 el.wrapInner('<span></span>'); 3014 } 3015 3016 }); 3017 3018 $('#menu span.icl_lang_sel_bracket').each(function() { 3019 var el = $(this); 3020 el.replaceWith(el.html()); 3021 }); 3022 3023 } 3024 mfnWPML(); 3025 3026 /** 3027 * Breadcrumbs | Remove last item link 3028 */ 3029 3030 function breadcrumbsRemoveLastLink() { 3031 3032 if( !$('.breadcrumbs.no-link').length ) return; 3033 3034 $('.breadcrumbs.no-link').each(function() { 3035 var el = $(this).find('li').last(); 3036 var text = el.text(); 3037 el.html(text); 3038 }); 3039 3040 } 3041 breadcrumbsRemoveLastLink(); 3042 3043 /** 3044 * Downcount 3045 */ 3046 3047 $('.downcount:not(.mfn-initialized)').each(function() { 3048 var el = $(this); 3049 el.addClass('mfn-initialized'); 3050 el.downCount({ 3051 date: el.attr('data-date'), 3052 offset: el.attr('data-offset') 3053 }); 3054 }); 3055 3056 /** 3057 * Hover | on Touch | .tooltip, .hover_box 3058 */ 3059 3060 $('.tooltip, .hover_box') 3061 .on('touchstart', function() { 3062 $(this).toggleClass('hover'); 3063 }) 3064 .on('touchend', function() { 3065 $(this).removeClass('hover'); 3066 }); 3067 3068 /** 3069 * Popup | Contact Form | Button 3070 */ 3071 3072 $("#popup_contact .footer_button").on('click', function(e) { 3073 e.preventDefault(); 3074 $(this).parent().toggleClass('focus'); 3075 }); 3076 3077 /** 3078 * Scroll | niceScroll for Header Creative 3079 */ 3080 3081 if ( $('#Header_creative.scroll').length && window.innerWidth >= 1240 ) { 3082 $('#Header_creative.scroll').niceScroll({ 3083 autohidemode: false, 3084 cursorborder: 0,
3085 cursorborderradius: 5, 3086 cursorcolor: '#222222', 3087 cursorwidth: 0, 3088 horizrailenabled: false, 3089 mousescrollstep: 40, 3090 scrollspeed: 60 3091 }); 3092 } 3093 3094 /** 3095 * Sliding Top 3096 */ 3097 3098 $('.sliding-top-control').on('click', function(e) { 3099 e.preventDefault(); 3100 $('#Sliding-top .widgets_wrapper').slideToggle(); 3101 $('#Sliding-top').toggleClass('active'); 3102 }); 3103 3104 /** 3105 * Alert 3106 */ 3107 3108 $('body').on('click', '.alert .close', function(e) { 3109 e.preventDefault(); 3110 $(this).closest('.alert').hide(300); 3111 }); 3112 3113 /** 3114 * Navigation Arrows | Sticky 3115 */ 3116 3117 $('.fixed-nav').appendTo('body'); 3118 3119 /** 3120 * Feature List 3121 */ 3122 3123 $('.feature_list').each(function() { 3124 var col = $(this).attr('data-col') ? $(this).attr('data-col') : 4; 3125 $(this).find('li:nth-child(' + col + 'n):not(:last-child)').after('<hr />'); 3126 }); 3127 3128 /** 3129 * IE Fixes 3130 */ 3131 3132 function checkIE() { 3133 // IE 9 3134 var ua = window.navigator.userAgent; 3135 var msie = ua.indexOf("MSIE "); 3136 if (msie > 0 && parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))) == 9) { 3137 $("body").addClass("ie"); 3138 } 3139 } 3140 checkIE(); 3141 3142 /** 3143 * Parallax 3144 */ 3145 3146 var ua = navigator.userAgent, 3147 isMobileWebkit = /WebKit/.test(ua) && /Mobile/.test(ua); 3148 3149 if ( ! isMobileWebkit && window.innerWidth >= 768 ) { 3150 3151 if (mfn.parallax == 'stellar') { 3152 3153 // Stellar 3154 $.stellar({ 3155 horizontalScrolling: false, 3156 responsive: true 3157 }); 3158 3159 } else { 3160 3161 $(window).enllax(); 3162 3163 } 3164 3165 } else { 3166 3167 $('div[data-enllax-ratio], div[data-stellar-ratio]').css('background-attachment', 'scroll'); 3168 3169 } 3170 3171 /** 3172 * Infinite Load More | Query Pagination Ajax 3173 */ 3174 3175 if( $('.mfn-query-pagination-infiniteload .next').length ){ 3176 var mfnQueryPaginationWaypoint = new Waypoint({ 3177 element: $('.mfn-query-pagination-infiniteload .next'), 3178 handler: function(direction) { 3179 $(this.element).trigger('click'); 3180 }, 3181 offset: '100%' 3182 }) 3183 } 3184 3185 /** 3186 * Load More | Query Pagination Ajax 3187 */ 3188 3189 if( $('.mfn-query-pagination-loadmore .next').length ){ 3190 $(document).on('click', '.mfn-query-pagination-loadmore .next', function(e) { 3191 e.preventDefault(); 3192 3193 if( $(this).hasClass('loading') ) return; 3194 3195 let button = $(this); 3196 let wrapper = '.'+button.closest('.mcb-section').attr('class').replaceAll(' ', '.').replaceAll(' ', '.'); 3197 let href = button.attr('href'); 3198 3199 button.addClass('loading'); 3200 3201 $.get( href, function( data ) { 3202 3203 $(wrapper+' .section_wrapper').append( $(wrapper+' .section_wrapper', data).html() ); 3204 if( $(wrapper+' .mfn-query-pagination', data).length ) $(wrapper+' .mfn-query-pagination').replaceWith($(wrapper+' .mfn-query-pagination', data)); 3205 3206 if( $(wrapper+' .isotope').length ){ 3207 $(wrapper+' .isotope').imagesLoaded().progress(function() { 3208 $(wrapper+' .isotope').isotope('reloadItems'); 3209 }); 3210 } 3211 3212 lightbox(); 3213 3214 if( $(wrapper).find('.mfn-query-loop-masonry').length ){ 3215 queryLoopMasonry(); 3216 } 3217 3218 3219 if( $(wrapper+' .mfn-query-pagination').hasClass('mfn-query-pagination-infiniteload') ){ 3220 mfnQueryPaginationWaypoint.destroy(); 3221 3222 3223 3224 $(wrapper).imagesLoaded(function() { 3225 3226 $(window).trigger('resize'); 3227 3228 if( $('.mfn-query-pagination-infiniteload .next').length ){ 3229 mfnQueryPaginationWaypoint = new Waypoint({ 3230 element: $('.mfn-query-pagination-infiniteload .next'), 3231 handler: function(direction) { 3232 $(this.element).trigger('click'); 3233 }, 3234 offset: '100%' 3235 }) 3236 3237 } 3238 3239 }); 3240 } 3241 3242 }); 3243 3244 }); 3245 } 3246 3247 /** 3248 * Load More | Ajax 3249 */ 3250 3251 $(document).on('click', '.pager_load_more', function(e) { 3252 e.preventDefault(); 3253 3254 var el = $(this); 3255 var pager = el.closest('.pager_lm'); 3256 3257 var href = el.attr('href'); 3258 3259 // index | for many items on the page 3260 var index = $('.lm_wrapper').index( el.closest('.mcb-column-inner, .elementor-element').find('.lm_wrapper') ); 3261 3262 el.fadeOut(50); 3263 pager.addClass('loading'); 3264 3265 $.get( href, function( data ) { 3266 3267 // content 3268 3269 // var content = $('.lm_wrapper', data).html(); 3270 // var $content = $(content); 3271 3272 var content = $('.lm_wrapper', data).eq(index).html(); 3273 var $content; 3274 3275 if (content.indexOf('<') === -1) { 3276 $content = $('<div>').text(content); 3277 } else { 3278 $content = $(content); 3279 } 3280 3281 href = $('.lm_wrapper:eq(' + index + ')', data).next().find('.pager_load_more').attr('href'); 3282 3283 if ($('.lm_wrapper:eq(' + index + ')').hasClass('isotope')) { 3284 3285 // isotope 3286 3287 const location = '.lm_wrapper:eq(' + index + ')'; 3288 $(location).append( $content ); 3289 3290 mfnIsotope.queryIsotopeAPI(location, 'appended', $content); 3291 mfnIsotope.addIsotopeLocation({ name: 'Load More - Ajax', location }); 3292 3293 if( $(location).find('.isotope-item').length ){ 3294 $(location).imagesLoaded().progress(function() { 3295 $(location).isotope('reloadItems'); 3296 }); 3297 } 3298 3299 } else if ($('.lm_wrapper:eq(' + index + ')').hasClass('mfn-woo-products')) { 3300 3301 // different .pager_load_more DOM location 3302 if (typeof href === 'undefined'){ 3303 href = $('.lm_wrapper:eq(' + index + ') .pager_load_more', data).attr('href'); 3304 } 3305 3306 $('.lm_wrapper:eq(' + index + ') ul.products').append( $content.html() ); 3307 3308 var $listing = $('.lm_wrapper:eq(' + index + ') ul.products.isotope'); 3309 3310 if( $listing.length ){ 3311 $listing.imagesLoaded().progress(function() { 3312 $listing.isotope('reloadItems'); 3313 }); 3314 } 3315 3316 } else { 3317 // default 3318 $content.hide().appendTo('.lm_wrapper:eq(' + index + ')').fadeIn(1000); 3319 } 3320 3321 // next page link 3322 3323 pager.removeClass('loading'); 3324 if (href) { 3325 el.fadeIn(); 3326 el.attr('href', href); 3327 } 3328 3329 // refresh some staff 3330 3331 lightbox(); 3332 3333 // isotope fix: second resize 3334 3335 if( $('.lm_wrapper.isotope').length ){ 3336 $('.lm_wrapper.isotope').imagesLoaded().progress(function() { 3337 mfnIsotope.queryIsotopeAPI( '.lm_wrapper.isotope' ); 3338 }); 3339 } 3340 3341 }); 3342 3343 }); 3344 3345 /** 3346 * Filters | Blog & Portfolio 3347 */ 3348 3349 $('.filters_buttons .open').on('click', function(e) { 3350 e.preventDefault(); 3351 var type = $(this).closest('li').attr('class'); 3352 3353 $('.filters_wrapper').show(200); 3354 $('.filters_wrapper ul.' + type).show(200); 3355 $('.filters_wrapper ul:not(.' + type + ')').hide(); 3356 }); 3357 3358 $('.filters_wrapper .close a').on('click', function(e) { 3359 e.preventDefault(); 3360 $('.filters_wrapper').hide(200); 3361 }); 3362 3363 /** 3364 * Portfolio List | Next v / Prev ^ buttons 3365 */ 3366 3367 $('.portfolio_next_js').on('click', function(e) { 3368 e.preventDefault(); 3369 3370 var item = $(this).closest('.portfolio-item').next(); 3371 3372 if (item.length) { 3373 $('html, body').animate({ 3374 scrollTop: item.offset().top - fixStickyHeaderH() 3375 }, 500); 3376 } 3377 }); 3378 3379 $('.portfolio_prev_js').on('click', function(e) { 3380 e.preventDefault(); 3381 3382 var item = $(this).closest('.portfolio-item').prev(); 3383 3384 if (item.length) { 3385 $('html, body').animate({ 3386 scrollTop: item.offset().top - fixStickyHeaderH() 3387 }, 500); 3388 } 3389 }); 3390 3391 /** 3392 * Link | Smooth Scroll | .scroll 3393 */ 3394 3395 $('body').on('click', '.scroll > a, a.scroll, .mcb-column.scroll a', function(e) { 3396 3397 // prevent default if link directs to the current page 3398 3399 // var urlL = location.href.replace(/\/#.*|#.*/, ''); 3400 // var urlT = this.href.replace(/\/#.*|#.*/, ''); // remove also trailing slash 3401 3402 var urlL = location.href.replace(/#.*/, ''); 3403 var urlT = this.href.replace(/#.*/, ''); 3404 3405 if (urlL == urlT) { 3406 e.preventDefault(); 3407 } 3408 3409 var hash = this.hash; 3410 3411 // offset 3412 3413 var headerFixedAbH = $('.header-fixed.ab-show #Action_bar').innerHeight() || 0; 3414 var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight() || 0; 3415 3416 var offset = headerFixedAbH + tabsHeaderH + adminBarH(); 3417 3418 // table of contents 3419 3420 if( $(this).parents('.table_of_content').length ){ 3421 offset += 30; 3422 } 3423 3424 // animate scroll 3425 3426 if (hash && $(hash).length) { 3427 3428 // do scroll 3429 3430 $('html, body').animate({
3431 scrollTop: $(hash).offset().top - offset - fixStickyHeaderH() 3432 }, 500, function(){ 3433 // fix: if something loads durring scroll 3434 $('html, body').animate({ 3435 scrollTop: $(hash).offset().top - offset - fixStickyHeaderH() 3436 }, 75); 3437 }); 3438 } 3439 }); 3440 3441 /** 3442 * Tabs 3443 */ 3444 3445 $('.jq-tabs').tabs(); 3446 3447 /** 3448 * Fake tabs 3449 */ 3450 3451 $('.fake-tabs > ul').on('click', 'a', function(e) { 3452 e.preventDefault(); 3453 3454 var $li = $(this).closest('li'); 3455 3456 var tab = $li.data('tab'); 3457 3458 if( $li.hasClass('active') ){ 3459 return; 3460 } 3461 3462 $li.addClass('active') 3463 .siblings().removeClass('active'); 3464 3465 $('.tab-'+ tab ).addClass('active').attr('tabindex', 0) 3466 .siblings('.tab').removeClass('active').attr('tabindex', -1); 3467 3468 $(window).trigger('resize'); 3469 }); 3470 3471 /** 3472 * Toggle 3473 */ 3474 3475 $('body').on('click', '.mfn-toggle .toggle-bar', function() { 3476 3477 var $parent = $(this).parent(), 3478 $toggle = $(this).closest('.mfn-toggle'); 3479 var speed = 100; 3480 3481 if ( $parent.hasClass('active') ) { 3482 3483 if( $toggle.is('.mfn-toggle-open-all') ){ 3484 return; 3485 } 3486 3487 $parent.removeClass('active') 3488 .children('.toggle-content').slideUp(speed); 3489 3490 } else { 3491 3492 $parent.addClass('active') 3493 .children('.toggle-content').slideDown(speed); 3494 3495 if( ! $toggle.is('.mfn-toggle-open-more') ){ 3496 $parent.siblings().removeClass('active') 3497 .children('.toggle-content').slideUp(speed); 3498 } 3499 3500 } 3501 3502 setTimeout(function() { 3503 $(window).trigger('resize'); 3504 }, speed); 3505 3506 }); 3507 3508 /** 3509 * Accordion & FAQ 3510 */ 3511 3512 $('.mfn-acc').each(function() { 3513 var el = $(this); 3514 3515 if (el.hasClass('openAll') || el.find('.wpb_toggle_title_active').length) { 3516 3517 // show all 3518 el.find('.question') 3519 .addClass('active') 3520 .children(".answer") 3521 .show(); 3522 3523 } else { 3524 3525 // show one 3526 var activeTab = el.attr('data-active-tab'); 3527 if (el.hasClass('open1st')) activeTab = 1; 3528 3529 if (activeTab) { 3530 el.find('.question').eq(activeTab - 1) 3531 .addClass('active') 3532 .children(".answer") 3533 .show(); 3534 } 3535 3536 } 3537 }); 3538 3539 $('.mfn-acc .question > .title').on('click', function() { 3540 3541 if ($(this).parent().hasClass('active')) { 3542 3543 $(this).parent().removeClass('active').children(".answer").slideToggle(100); 3544 3545 } else { 3546 3547 if (!$(this).closest('.mfn-acc').hasClass('toggle')) { 3548 $(this).parents(".mfn-acc").children().each(function() { 3549 if ($(this).hasClass('active')) { 3550 $(this).removeClass('active').children(".answer").slideToggle(100); 3551 } 3552 }); 3553 } 3554 $(this).parent().addClass('active'); 3555 $(this).next(".answer").slideToggle(100); 3556 3557 } 3558 3559 setTimeout(function() { 3560 $(window).trigger('resize'); 3561 }, 50); 3562 3563 }); 3564 3565 // Visual Composer | Accordion | Sidebar height 3566 $('.wpb_wrapper .vc_tta-panel-title').on('click', 'a', function() { 3567 3568 setTimeout(function() { 3569 $(window).trigger('resize'); 3570 }, 50); 3571 3572 }); 3573 3574 /** 3575 * Helper 3576 */ 3577 3578 $('.helper .link.toggle').on('click', function(e) { 3579 3580 e.preventDefault(); 3581 3582 var el = $(this); 3583 var id = el.attr('data-rel'); 3584 var parent = el.closest('.helper'); 3585 3586 if (el.hasClass('active')) { 3587 3588 el.removeClass('active'); 3589 parent.find('.helper_content > .item-' + id).slideUp(200); 3590 3591 setTimeout(function() { 3592 parent.find('.helper_content > .item-' + id).removeClass('active'); 3593 }, 200); 3594 3595 } else { 3596 3597 parent.find('.links > .link.active').removeClass('active'); 3598 parent.find('.helper_content > .item.active').slideUp(200); 3599 3600 el.addClass('active'); 3601 parent.find('.helper_content > .item-' + id).addClass('active').hide().slideDown(200); 3602 3603 } 3604 3605 setTimeout(function() { 3606 $(window).trigger('resize'); 3607 }, 50); 3608 3609 }); 3610 3611 /** 3612 * Love 3613 */ 3614 3615 $(document).on('click', '.mfn-love', function(e) { 3616 e.preventDefault(); 3617 var el = $(this); 3618 3619 if (el.hasClass('loved')) { 3620 return false;
3621 } 3622 el.addClass('loved'); 3623 3624 var post = { 3625 action: 'mfn_love', 3626 post_id: el.attr('data-id') 3627 }; 3628 3629 $.post(mfn.ajax, post, function(data) { 3630 el.find('.label').html(data); 3631 }); 3632 3633 return false; 3634 }); 3635 3636 /** 3637 * Go to top 3638 */ 3639 3640 $('#back_to_top').on('click', function() { 3641 $('body,html').animate({ 3642 scrollTop: 0 3643 }, 500); 3644 return false; 3645 }); 3646 3647 /** 3648 * Section | Next v / Prev ^ navigation arrows 3649 */ 3650 3651 $('.section .section-nav').on('click', function() { 3652 3653 var el = $(this); 3654 var section = el.closest('.section'); 3655 3656 var offset = fixStickyHeaderH() + adminBarH(); 3657 3658 if (el.hasClass('prev')) { 3659 3660 // Previous Section 3661 if (section.prev().length) { 3662 $('html, body').animate({ 3663 scrollTop: section.prev().offset().top - offset 3664 }, 500); 3665 } 3666 3667 } else { 3668 3669 // Next Section 3670 if (section.next().length) { 3671 $('html, body').animate({ 3672 scrollTop: section.next().offset().top - offset 3673 }, 500); 3674 } 3675 3676 } 3677 }); 3678 3679 /** 3680 * Intro | Scroll v arrow 3681 */ 3682 3683 $('#Intro .intro-next').on('click', function() { 3684 var intro = $(this).closest('#Intro'); 3685 3686 if (intro.next().length) { 3687 $('html, body').animate({ 3688 scrollTop: intro.next().offset().top - fixStickyHeaderH() - adminBarH() 3689 }, 500); 3690 } 3691 }); 3692 3693 /** 3694 * Widget | Muffin Menu | Hover on click 3695 */ 3696 3697 $('.widget_mfn_menu ul.submenus-click, .widget_mfn_menu ul.submenus-click-mobile').each(function() { 3698 3699 var el = $(this); 3700 3701 if( el.is('.submenus-click-mobile') && $(window).width() > 767 ){ 3702 return; 3703 } 3704 3705 $('a', el).on('click', function(e) { 3706 var li = $(this).closest('li'); 3707 3708 if (li.hasClass('hover') || !li.hasClass('menu-item-has-children')) { 3709 // link click 3710 } else { 3711 e.preventDefault(); 3712 li.siblings('li').removeClass('hover') 3713 .find('li').removeClass('hover'); 3714 $(this).closest('li').addClass('hover'); 3715 } 3716 3717 }); 3718 3719 }); 3720 3721 /** 3722 * WooCommerce | Add to cart 3723 */ 3724 3725 function addToCart() { 3726 3727 $('body').on('click', '.add_to_cart_button', function() { 3728 $(this) 3729 .closest('.product') 3730 .addClass('adding-to-cart') 3731 .removeClass('added-to-cart'); 3732 }); 3733 3734 $('body').on('added_to_cart', function() { 3735 $('.adding-to-cart') 3736 .removeClass('adding-to-cart') 3737 .addClass('added-to-cart'); 3738 }); 3739 } 3740 addToCart(); 3741 3742 /** 3743 * WooCommerce | Rating click 3744 */ 3745 3746 $('.woocommerce-product-rating').on('click', function(){ 3747 3748 var el; 3749 3750 if( $('.product_tabs_wrapper.fake-tabs').length ){ 3751 3752 el = $('.product_tabs_wrapper.fake-tabs'); 3753 $('li[data-tab="reviews"] a', el).trigger('click'); 3754 3755 } else if( $('.woocommerce-content .jq-tabs').length ){ 3756 3757 el = $('.woocommerce-content .jq-tabs'); 3758 $('.ui-tabs-nav a[href="#tab-reviews"]', el).trigger('click'); 3759 3760 } else { 3761 3762 el = $('.woocommerce-content .accordion'); 3763 $('#reviews').closest('.question:not(.active)').children('.title').trigger('click'); 3764 3765 } 3766 3767 // offset 3768 3769 var actionBarH = $('.header-fixed.ab-show #Action_bar').innerHeight() || 0; 3770 var offset = actionBarH + adminBarH(); 3771 3772 // animate scroll 3773 3774 $('html, body').animate({ 3775 scrollTop: el.offset().top - offset - fixStickyHeaderH() 3776 }, 500); 3777 3778 }); 3779 3780 /** 3781 * WooCommerce | Quantity change 3782 */ 3783 3784 $('body').on('click', '.quantity-change', function(e){ 3785 3786 e.preventDefault(); 3787 3788 var $el = $(this), 3789 $input = $(this).siblings('input'); 3790 3791 var step = parseFloat($input.attr('step')) || 1, 3792 minAttr = $input.attr('min'), 3793 min = typeof minAttr !== typeof undefined && minAttr !== false ? parseFloat(minAttr) : 1, 3794 max = parseFloat($input.attr('max')) || 9999, 3795 current = $input.val() ? parseFloat($input.val()) : min, 3796 val = 0; 3797 3798 if( $el.hasClass('plus') ){ 3799 val = current + step; 3800 if( val > max ){ 3801 val = current; 3802 } 3803 } else { 3804 val = current - step; 3805 if( val < min ){ 3806 val = current; 3807 } 3808 } 3809 3810 val = Math.round(val * 10) / 10; 3811 3812 $input.val(val).trigger('change'); 3813 3814 }); 3815 3816 /** 3817 * Ajax | Complete 3818 */ 3819 3820 $(document).ajaxComplete(function() { 3821 3822 setTimeout(function() { 3823 $(window).trigger('resize'); 3824 mfnSidebar(); 3825 }, 100); 3826 3827 }); 3828 3829 /** 3830 * $(window).on('debouncedresize') 3831 * Specify a function to execute on window resize 3832 */ 3833 3834 $(window).on('debouncedresize', function() { 3835 3836 // isotope 3837 mfnIsotope.runIsotopes( false ); 3838 3839 // sliding footer height 3840 3841 mfnFooter(); 3842 3843 // header width 3844 3845 headerWidth(); 3846 3847 // sidebar height 3848 3849 mfnSidebar(); 3850 3851 // intro header 3852 3853 mfnIntroH(); 3854 3855 // mobile sticky for header creative 3856 3857 creativeHeaderFix(); 3858 3859 }); 3860 3861 /** 3862 * Bind() 3863 */ 3864 3865 // consent 3866 3867 $('.mfn-cookies').on('click','.cookies-tab-nav a', function(e){ 3868 e.preventDefault(); 3869 consent.tabs($(this), false); 3870 }); 3871 3872 $('.mfn-cookies').on('click','#consent_customize', function(e){ 3873 e.preventDefault(); 3874 consent.tabs(false, 'details'); 3875 }); 3876 3877 $('.mfn-cookies').on('click','#consent_allow', function(e){ 3878 e.preventDefault(); 3879 consent.all(); 3880 }); 3881 3882 $('.mfn-cookies').on('click','#consent_selected', function(e){ 3883 e.preventDefault(); 3884 consent.selected(); 3885 }); 3886 3887 $('.mfn-cookies').on('click','#consent_deny', function(e){ 3888 e.preventDefault(); 3889 consent.deny(); 3890 }); 3891 3892 $('.mfn-cookies-reopen').on('click', function(e){ 3893 consent.reopen(); 3894 }); 3895 3896 /** 3897 * document.ready 3898 * Initialize document ready functions 3899 */ 3900 3901 mfnSliderBlog(); 3902 mfnSliderClients(); 3903 mfnSliderOffer(); 3904 mfnSliderOfferThumb(); 3905 mfnSliderShop(); 3906 3907 sliderPortfolio(); 3908 sliderTestimonials(); 3909 3910 // sliding footer height 3911 3912 mfnFooter(); 3913 3914 // header width 3915 3916 headerWidth(); 3917 3918 // sidebar height 3919 3920 mfnSidebar(); 3921 3922 // intro header 3923 3924 mfnIntroH(); 3925 3926 // hash navigation 3927 3928 hashNav(); 3929 3930 // GDPR container display 3931 3932 gdpr(); // gdpr 1.0 3933 consent.open(); // gdpr 2.0 3934 3935 // table of contents 3936 3937 tableContentAttachId(); 3938 3939 // top bar top position 3940 3941 topBarTopPosition(); 3942 3943 if( !$('body').hasClass('mfn-ui') ) mfnPopup.init(); 3944 3945 }); 3946 3947 /** 3948 * $(window).on('scroll') 3949 * The scroll event is sent to an element when the user scrolls to a different place in the element. 3950 */ 3951 3952 $(window).on('scroll', function() { 3953 3954 // sticky header 3955 3956 mfnSticky(); 3957 mfnMobileSticky(); 3958 3959 // sticky back to top 3960 3961 backToTopSticky(); 3962 3963 // one page scroll active 3964 3965 onePageActive(); 3966 3967 }); 3968 3969 /** 3970 * $(window).on('load') 3971 * window.load 3972 */ 3973 3974 $(window).on('load', function() { 3975 3976 preloader(); 3977 3978 queryLoopMasonry(); 3979 3980 // align divs heights 3981 3982 alignHeights(); 3983 3984 /** 3985 * Elementor plugin 3986 * Disable built-in one page 3987 */ 3988 3989 function elementorDisableOnePage(){ 3990 3991 if( ! $('body').hasClass('one-page') ){ 3992 return false;
3993 } 3994 3995 setTimeout(function(){ 3996 var doc=$(document), 3997 $events=$("a[href*='#']").length ? $._data(doc[0],"events") : null; 3998 if($events && $events.click){ 3999 for(var i=$events.click.length-1; i>=0; i--){ 4000 var handler=$events.click[i]; 4001 if(handler && handler.namespace != "mPS2id" && handler.selector === 'a[href*="#"]' ) doc.off("click",handler.handler); 4002 } 4003 } 4004 }, 300); 4005 4006 } 4007 4008 elementorDisableOnePage(); 4009 4010 /** 4011 * Live search item 4012 * z-index for live search item parents 4013 */ 4014 4015 function liveSearchItemZindex(){ 4016 4017 $('.column_livesearch').each(function(){ 4018 $(this).closest('.mcb-wrap').addClass('has-live-search-element') 4019 .closest('.mcb-section').addClass('has-live-search-element'); 4020 }); 4021 4022 } 4023 4024 liveSearchItemZindex(); 4025 4026 /** 4027 * Retina Logo 4028 */ 4029 4030 function retinaLogo() { 4031 4032 // ! retina display 4033 4034 if( window.devicePixelRatio <= 1 ){ 4035 return false; 4036 } 4037 4038 var el, src, height, 4039 parent = $('#Top_bar #logo'), 4040 parentH = parent.data('height'); 4041 4042 var maxH = { 4043 sticky: { 4044 init: 35, 4045 noPadding: 60, 4046 overflow: 110 4047 }, 4048 mobile: { 4049 mini: 50, 4050 miniNoPadding: 60 4051 }, 4052 mobileSticky: { 4053 init: 50, 4054 noPadding: 60, 4055 overflow: 80 4056 } 4057 }; 4058 4059 $('#Top_bar #logo img').each(function(index) { 4060 4061 el = $(this); 4062 src = el.data('retina'); 4063 height = el.height() || 0; 4064 4065 // main 4066 4067 if (el.hasClass('logo-main')) { 4068 4069 if ($('body').hasClass('logo-overflow')) { 4070 4071 // do nothing 4072 4073 } else if (height > parentH) { 4074 4075 height = parentH; 4076 4077 } 4078 4079 } 4080 4081 // sticky 4082 4083 if (el.hasClass('logo-sticky')) { 4084 4085 if ($('body').hasClass('logo-overflow')) { 4086 4087 if (height > maxH.sticky.overflow) { 4088 height = maxH.sticky.overflow; 4089 } 4090 4091 } else if ($('body').hasClass('logo-no-sticky-padding')) { 4092 4093 if (height > maxH.sticky.noPadding) { 4094 height = maxH.sticky.noPadding; 4095 } 4096 4097 } else if (height > maxH.sticky.init) { 4098 4099 height = maxH.sticky.init; 4100 4101 } 4102 4103 } 4104 4105 // mobile 4106 4107 if (el.hasClass('logo-mobile')) { 4108 4109 if ($('body').hasClass('mobile-header-mini')) { 4110 4111 if (parent.data('padding') > 0) { 4112 4113 if (height > maxH.mobile.mini) { 4114 height = maxH.mobile.mini; 4115 } 4116 4117 } else { 4118 4119 if (height > maxH.mobile.miniNoPadding) { 4120 height = maxH.mobile.miniNoPadding; 4121 } 4122 4123 } 4124 4125 } 4126 4127 } 4128 4129 // mobile-sticky 4130 4131 if (el.hasClass('logo-mobile-sticky')) { 4132 4133 if ($('body').hasClass('logo-no-sticky-padding')) { 4134 4135 if (height > maxH.mobileSticky.noPadding) { 4136 height = maxH.mobileSticky.noPadding; 4137 } 4138 4139 } else if (height > maxH.mobileSticky.init) { 4140 height = maxH.mobileSticky.init; 4141 } 4142 4143 } 4144 4145 // SET 4146 4147 if (src) { 4148 el.parent().addClass('retina'); 4149 el.attr('src', src).css('max-height', height + 'px'); 4150 } 4151 4152 }); 4153 4154 } 4155 4156 setTimeout(function() { 4157 retinaLogo(); 4158 }, 0); // jQuery 3.5 window.load 4159 4160 /** 4161 * Before After | TwentyTwenty 4162 */ 4163 4164 $('#Wrapper .before_after.twentytwenty-container:not(.mfn-initialized)').each(function(){ 4165 4166 var el = $(this); 4167 4168 el.addClass('mfn-initialized'); 4169 el.imagesLoaded().done(function(instance, image){ 4170 4171 queueMicrotask(() => el.twentytwenty()); 4172 4173 }); 4174 4175 }); 4176 4177 // Visual Composer prettyPhoto | off 4178 4179 if ( lightboxAttr ) { 4180 $('a[data-rel^="prettyPhoto"]:not(.popup-link), a[rel^="lightbox"]:not(.popup-link)').each(function() { 4181 $(this).off('click.prettyphoto'); 4182 }); 4183 } 4184 4185 /** 4186 * Reload some functions on window.load 4187 */ 4188 4189 // sticky header 4190 4191 mfnStickyH(); 4192 mfnSticky(); 4193 mfnMobileSticky(); 4194 4195 // intro header 4196 4197 mfnIntroH(); 4198 4199 // FIX | jQuery 3.5 window.load 4200 4201 setTimeout(function() { 4202
4203 // triger resize to recalculate some plugins stuff 4204 $(window).trigger('resize'); 4205 4206 // sidebar height 4207 4208 mfnSidebar(); 4209 4210 // sliders 4211 4212 sliderSlider(); 4213 4214 }, 0); 4215 4216 }); 4217 4218 /** 4219 * $(document).on('mouseup') 4220 * Specify a function to execute when the DOM is fully loaded. 4221 * Close some modals when click outside 4222 */ 4223 4224 $(document).on('mouseup',function(e) { 4225 4226 // Widget | Muffin menu | Hover on click 4227 4228 if ($('.widget_mfn_menu ul.submenus-click').length && ($('.widget_mfn_menu ul.submenus-click').has(e.target).length === 0) ) { 4229 $('.widget_mfn_menu ul.submenus-click li').removeClass('hover'); 4230 } 4231 4232 // Mobile menu | Classic 4233 4234 if ($('.menu_wrapper').length && ( $('.menu_wrapper').has(e.target).length === 0 )) { 4235 if( $('.responsive-menu-toggle').hasClass('active') ){ 4236 $('.responsive-menu-toggle').trigger('click'); 4237 } 4238 } 4239 4240 // Popup contact form 4241 4242 if ($('#popup_contact').length && ( $('#popup_contact').has(e.target).length === 0 )) { 4243 if( $('#popup_contact').hasClass('focus') ){ 4244 $('#popup_contact .footer_button').trigger('click'); 4245 } 4246 } 4247 4248 // Off canvas sidebar 4249 4250 if($('html').hasClass('mfn-ofcs-opened') && !$('.mfn-off-canvas-sidebar').is(e.target) && $('.mfn-off-canvas-sidebar').has(e.target).length === 0){ 4251 $('html').removeClass('mfn-ofcs-opened'); 4252 } 4253 4254 }); 4255 4256 /** 4257 * Sliders configuration 4258 */ 4259 4260 // Slick Slider | Auto responsive 4261 4262 function slickAutoResponsive(slider, max, size, round = false) { 4263 4264 if (!max){ 4265 max = 5; 4266 } 4267 if (!size){ 4268 size = 380; 4269 } 4270 4271 var width = slider.width() || 0; 4272 var count; 4273 4274 if ( round ) { 4275 count = Math.floor(width / size); 4276 } else { 4277 count = Math.ceil(width / size); 4278 } 4279 4280 if (count < 1) count = 1; 4281 if (count > max) count = max; 4282 4283 return count; 4284 } 4285 4286 // Slider | Offer Thumb 4287 4288 function mfnSliderOfferThumb() { 4289 4290 var pager = function(el, i) { 4291 var img = $(el.$slides[i]).find('.thumbnail:first').html(); 4292 return '<a>' + img + '</a>'; 4293 }; 4294 4295 $('.offer_thumb_ul').each(function() { 4296 4297 var slider = $(this); 4298 4299 slider.slick({ 4300 cssEase: 'ease-out', 4301 arrows: false, 4302 dots: true, 4303 infinite: true, 4304 touchThreshold: 10, 4305 speed: 300, 4306 4307 adaptiveHeight: true, 4308 appendDots: slider.siblings('.slider_pagination'), 4309 customPaging: pager, 4310 4311 rtl: rtl ? true : false, 4312 autoplay: mfn.slider.offer ? true : false, 4313 autoplaySpeed: mfn.slider.offer ? mfn.slider.offer : 5000, 4314 4315 slidesToShow: 1, 4316 slidesToScroll: 1 4317 }); 4318 4319 // ON | debouncedresize 4320 4321 $(window).on('debouncedresize', function() { 4322 // set slider min-height to thumbnails height 4323 var height = slider.siblings('.slider_pagination').height(); 4324 slider.closest('.offer_thumb ').css('min-height',height); 4325 }); 4326 4327 }); 4328 } 4329 4330 // Slider | Offer 4331 4332 function mfnSliderOffer() { 4333 $('.offer_ul').each(function() { 4334 4335 var slider = $(this); 4336 4337 slider.slick({ 4338 cssEase: 'ease-out', 4339 dots: false, 4340 infinite: true, 4341 touchThreshold: 10, 4342 speed: 300, 4343 4344 prevArrow: '<a class="slider_prev" href="#" aria-label="previous slide"><span class="button_icon"><i class="icon-up-open-big"></i></span></a>', 4345 nextArrow: '<a class="slider_next" href="#" aria-label="next slide"><span class="button_icon"><i class="icon-down-open-big"></i></span></a>', 4346 4347 adaptiveHeight: true, 4348 //customPaging : pager, 4349 4350 rtl: rtl ? true : false, 4351 autoplay: mfn.slider.offer ? true : false, 4352 autoplaySpeed: mfn.slider.offer ? mfn.slider.offer : 5000, 4353 4354 slidesToShow: 1, 4355 slidesToScroll: 1 4356 }); 4357 4358 // Pagination | Show (css) 4359 4360 slider.siblings('.slider_pagination').addClass('show'); 4361 4362 // Pager | Set slide number after change 4363 4364 slider.on('afterChange', function(event, slick, currentSlide, nextSlide) { 4365 slider.siblings('.slider_pagination').find('.current').text(currentSlide + 1); 4366 }); 4367 4368 }); 4369 } 4370 4371 // Slider | Shop 4372 4373 function mfnSliderShop() { 4374 4375 var pager = function(el, i) { 4376 return '<a>' + i + '</a>'; 4377 }; 4378 4379 $('.shop_slider_ul').each(function() { 4380 4381 var slider = $(this); 4382 var slidesToShow = 4; 4383 4384 var count = slider.closest('.shop_slider').data('count'); 4385 if (slidesToShow > count) { 4386 slidesToShow = count; 4387 if (slidesToShow < 1) { 4388 slidesToShow = 1; 4389 } 4390 } 4391 4392 slider.slick({ 4393 cssEase: 'ease-out', 4394 dots: true, 4395 infinite: true, 4396 touchThreshold: 10, 4397 speed: 300, 4398 4399 prevArrow: '<a class="button the-icon slider_prev" href="#" aria-label="previous slide"><i class="icon-left-open-big"></i></a>', 4400 nextArrow: '<a class="button the-icon slider_next" href="#" aria-label="next slide"><i class="icon-right-open-big"></i></a>', 4401 appendArrows: slider.siblings('.blog_slider_header').children('.slider_navigation'), 4402 4403 appendDots: slider.siblings('.slider_pager'), 4404 customPaging: pager, 4405 4406 rtl: rtl ? true : false, 4407 autoplay: mfn.slider.shop ? true : false, 4408 autoplaySpeed: mfn.slider.shop ? mfn.slider.shop : 5000, 4409 4410 slidesToShow: slickAutoResponsive(slider, slidesToShow), 4411 slidesToScroll: slickAutoResponsive(slider, slidesToShow) 4412 }); 4413 4414 // ON | debouncedresize 4415 4416 $(window).on('debouncedresize', function() { 4417 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, slidesToShow), false); 4418 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, slidesToShow), true); 4419 }); 4420 4421 }); 4422 } 4423 4424 // Slider | Blog 4425 4426 function mfnSliderBlog() { 4427 4428 var pager = function(el, i) { 4429 return '<a>' + i + '</a>'; 4430 }; 4431 4432 $('.blog_slider_ul').each(function() { 4433 4434 var slider = $(this); 4435 var slidesToShow = 4; 4436 4437 var count = slider.closest('.blog_slider').data('count'); 4438 var singlePostMode = slider.closest('.blog_slider').hasClass('single_post_mode'); 4439 4440 if (slidesToShow > count) { 4441 slidesToShow = count; 4442 if (slidesToShow < 1) { 4443 slidesToShow = 1; 4444 } 4445 } 4446 4447 if (singlePostMode) { 4448 slidesToShow = 1; 4449 } 4450 4451 slider.slick({ 4452 cssEase: 'ease-out', 4453 dots: true, 4454 infinite: true, 4455 touchThreshold: 10, 4456 speed: 300, 4457 4458 prevArrow: '<a class="button the-icon slider_prev" href="#" aria-label="previous slide"><i class="icon-left-open-big"></i></a>', 4459 nextArrow: '<a class="button the-icon slider_next" href="#" aria-label="next slide"><i class="icon-right-open-big"></i></a>', 4460 appendArrows: slider.siblings('.blog_slider_header').children('.slider_navigation'), 4461 4462 appendDots: slider.siblings('.slider_pager'), 4463 customPaging: pager, 4464 4465 rtl: rtl ? true : false, 4466 autoplay: mfn.slider.blog ? true : false, 4467 autoplaySpeed: mfn.slider.blog ? mfn.slider.blog : 5000, 4468 4469 slidesToShow: slickAutoResponsive(slider, slidesToShow), 4470 slidesToScroll: slickAutoResponsive(slider, slidesToShow) 4471 }); 4472 4473 // On | debouncedresize 4474 4475 $(window).on('debouncedresize', function() { 4476 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, slidesToShow), false); 4477 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, slidesToShow), true); 4478 }); 4479 4480 }); 4481 } 4482 4483 // Slider | Clients 4484 4485 function mfnSliderClients() { 4486 $('.clients_slider_ul').each(function() { 4487 4488 var slider = $(this); 4489 4490 var clientsPerSlide = slider.closest('.clients_slider').attr('data-client-per-slide') ? parseInt(slider.closest('.clients_slider').attr('data-client-per-slide')) : 4; 4491 var navigationPosition = slider.closest('.clients_slider').attr('data-navigation-position') || false; 4492 var appendArrows = ( navigationPosition == 'content' ) ? slider : slider.siblings('.blog_slider_header').children('.slider_navigation'); 4493 var size = 400; 4494 4495 var calc = () => slickAutoResponsive(slider, clientsPerSlide, size - (clientsPerSlide * 40), true); 4496 var calcScroll = calc; 4497 var slidesToScroll = slider.closest('.clients_slider').attr('data-sli
4497des-to-scroll') ? parseInt(slider.closest('.clients_slider').attr('data-slides-to-scroll')) : calc(); 4498 4499 if( 1 === slidesToScroll ){ 4500 calcScroll = () => slickAutoResponsive(slider, 1, size - (clientsPerSlide * 40), true); 4501 } 4502 4503 slider.slick({ 4504 cssEase: 'ease-out', 4505 dots: false, 4506 infinite: true, 4507 touchThreshold: 10, 4508 speed: 300, 4509 4510 prevArrow: '<a class="button the-icon slider_prev" href="#" aria-label="previous slide"><i class="icon-left-open-big"></i></a>', 4511 nextArrow: '<a class="button the-icon slider_next" href="#" aria-label="next slide"><i class="icon-right-open-big"></i></a>', 4512 appendArrows: appendArrows, 4513 4514 rtl: rtl ? true : false, 4515 autoplay: mfn.slider.clients ? true : false, 4516 autoplaySpeed: mfn.slider.clients ? mfn.slider.clients : 5000, 4517 4518 slidesToShow: calc(), 4519 slidesToScroll: calcScroll() 4520 }); 4521 4522 // ON | debouncedresize 4523 4524 $(window).on('debouncedresize', function() { 4525 slider.slick('slickSetOption', 'slidesToShow', calc(), false); 4526 slider.slick('slickSetOption', 'slidesToScroll', calcScroll(), true); 4527 }); 4528 4529 }); 4530 } 4531 4532 // Slider | Portfolio 4533 4534 function sliderPortfolio() { 4535 4536 $('.portfolio_slider_ul').each(function() { 4537 4538 var slider = $(this); 4539 var size = 380; 4540 var scroll = 5; 4541 4542 if (slider.closest('.portfolio_slider').data('size')) { 4543 size = slider.closest('.portfolio_slider').data('size'); 4544 } 4545 4546 if (slider.closest('.portfolio_slider').data('size')) { 4547 scroll = slider.closest('.portfolio_slider').data('scroll'); 4548 } 4549 4550 slider.slick({ 4551 cssEase: 'ease-out', 4552 dots: false, 4553 infinite: true, 4554 touchThreshold: 10, 4555 speed: 300, 4556 4557 prevArrow: '<a class="slider_nav slider_prev themebg" href="#" aria-label="previous slide"><i class="icon-left-open-big"></i></a>', 4558 nextArrow: '<a class="slider_nav slider_next themebg" href="#" aria-label="next slide"><i class="icon-right-open-big"></i></a>', 4559 4560 rtl: rtl ? true : false, 4561 autoplay: mfn.slider.portfolio ? true : false, 4562 autoplaySpeed: mfn.slider.portfolio ? mfn.slider.portfolio : 5000, 4563 4564 slidesToShow: slickAutoResponsive(slider, 5, size), 4565 slidesToScroll: slickAutoResponsive(slider, scroll, size) 4566 }); 4567 4568 // ON | debouncedresize 4569 $(window).on('debouncedresize', function() { 4570 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, 5, size), false); 4571 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, scroll, size), true); 4572 }); 4573 4574 }); 4575 } 4576 4577 // header promo bar | Slider 4578 4579 function promoBarSlider() { 4580 $('.promo_bar_slider').each(function() { 4581 var $slider = $(this); 4582 4583 if ($slider.hasClass('mfn-initialized')) return; 4584 $slider.addClass('mfn-initialized'); 4585 4586 var speedAttr = $slider.attr('data-speed'); 4587 var speed = parseInt(speedAttr, 10); 4588 if (isNaN(speed) || speed <= 0) speed = 5; 4589 speed *= 1000; 4590 4591 var $slides = $slider.find('.pbs_one'); 4592 if (!$slides.length) return; 4593 4594 $slides.removeClass('pbs-active pbs-active-ends'); 4595 $slides.first().addClass('pbs-active'); 4596 4597 var transitionDuration = 300; 4598 4599 function changeSlide() { 4600 var $current = $slider.find('.pbs_one.pbs-active'); 4601 var $next = $current.next('.pbs_one'); 4602 4603 if (!$next.length) $next = $slides.first(); 4604 4605 $current.addClass('pbs-active-ends'); 4606 4607 setTimeout(function() { 4608 $current.removeClass('pbs-active pbs-active-ends'); 4609 $next.addClass('pbs-active'); 4610 }, transitionDuration); 4611 } 4612 4613 if ($slides.length > 1) { 4614 setInterval(changeSlide, speed); 4615 } 4616 }); 4617 } 4618 4619 4620 4621 // section slider 4622 4623 function queryLoopSlider() { 4624 $('body:not(.mfn-ui) .mfn-looped-items-slider').each(function(i) { 4625 4626 const swipers = []; 4627 4628 var $slider = $(this); 4629 4630 let swiperClass = 'mfn-ql-slider-'+i; 4631 4632 $slider.addClass(swiperClass); 4633 4634 var swiperParams = { 4635 spaceBetween: parseInt($slider.attr('data-space_mobile')), 4636 slidesPerView: $slider.hasClass('mfn-slider-linear') ? 'auto' : parseInt($slider.attr('data-columns-mobile')), 4637 }; 4638 4639 if( typeof $slider.attr('data-dots') !== 'undefined' && $slider.attr('data-dots') == '1' ) { 4640 $slider.parent().append('<div class="swiper-pagination mfn-swiper-pagination-'+i+'"></div>'); 4641 swiperParams['pagination'] = { 4642 el: ".mfn-swiper-pagination-"+i, 4643 clickable: true, 4644 }; 4645 4646 if( $slider.attr('data-dots-count') == 'dynamic' ) { 4647 swiperParams['pagination']['dynamicBullets'] = true; 4648 } 4649 } 4650 4651 if( $slider.closest('.mfn-looped-items').hasClass('mfn-ql-slider-wrapper-offset') && $slider.attr('data-infinity') == '1' ) { 4652 swiperParams['loop'] = true; 4653 swiperParams['centeredSlides'] = true; 4654 $slider.parent().css({ 'max-width': '100%'}); 4655 }else if( $slider.attr('data-infinity') == '1' ) { 4656 swiperParams['loop'] = true; 4657 } 4658 4659 /*if( $slider.attr('data-pausehover') == '1' ) { 4660 4661 }*/ 4662 4663 swiperParams['speed'] = parseFloat($slider.attr('data-speed')); 4664 4665 if( $slider.attr('data-arrows') == '1' ){ 4666 $slider.parent().append('<div class="swiper-button-next mfn-swiper-arrow mfn-swiper-button-next-'+i+'"><i class="'+$slider.attr('data-arrownext')+'"></i></div><div class="swiper-button-prev mfn-swiper-arrow mfn-swiper-button-prev-'+i+'"><i class="'+$slider.attr('data-arrowprev')+'"></i></div>'); 4667 swiperParams['navigation'] = { 4668 nextEl: ".mfn-swiper-button-next-"+i, 4669 prevEl: ".mfn-swiper-button-prev-"+i, 4670 }; 4671 } 4672 4673 if( !$('body').hasClass('mfn-ui') && typeof $slider.attr('data-autoplay') !== 'undefined' && parseFloat($slider.attr('data-autoplay')) > 0 ) { 4674 swiperParams['autoplay'] = { 4675 delay: $slider.hasClass('mfn-slider-linear') ? 0.1 : parseFloat($slider.attr('data-autoplay')), 4676 disableOnInteraction: true, 4677 }; 4678 4679 if( $slider.attr('data-pausehover') == '1' ){ 4680 // swiperParams['autoplay']['disableOnInteraction'] = true; 4681 swiperParams['autoplay']['pauseOnMouseEnter'] = true; 4682 }else{ 4683 // swiperParams['autoplay']['disableOnInteraction'] = false;
4684 swiperParams['autoplay']['pauseOnMouseEnter'] = false; 4685 } 4686 } 4687 4688 if( !$('body').hasClass('mfn-ui') && typeof $slider.attr('data-mousewheel') !== 'undefined' && $slider.attr('data-mousewheel') > 0 ) { 4689 swiperParams['mousewheel'] = true; 4690 } 4691 4692 if( $('body').hasClass('mfn-ui') ) { 4693 swiperParams['allowTouchMove'] = true; 4694 } 4695 4696 // popup fix 4697 if( $slider.closest('.mfn-popup-tmpl').length ){ 4698 swiperParams['observer'] = true; 4699 swiperParams['observeParents'] = true; 4700 } 4701 4702 swiperParams['breakpoints'] = { 4703 768: { 4704 spaceBetween: $slider.attr('data-animationtype') == 'cube' ? 0 : parseInt($slider.attr('data-space_desktop')), 4705 slidesPerView: $slider.hasClass('mfn-slider-linear') ? 'auto' : parseInt($slider.attr('data-columns-tablet')) 4706 }, 4707 960: { 4708 spaceBetween: $slider.attr('data-animationtype') == 'cube' ? 0 : parseInt($slider.attr('data-space_desktop')), 4709 slidesPerView: $slider.hasClass('mfn-slider-linear') ? 'auto' : parseInt($slider.attr('data-columns-laptop')) 4710 }, 4711 1441: { 4712 spaceBetween: $slider.attr('data-animationtype') == 'cube' ? 0 : parseInt($slider.attr('data-space_desktop')), 4713 slidesPerView: $slider.hasClass('mfn-slider-linear') ? 'auto' : parseInt($slider.attr('data-columns')) 4714 } 4715 }; 4716 4717 if( $slider.attr('data-animationtype') != 'slide' ) { 4718 swiperParams['effect'] = $slider.attr('data-animationtype'); 4719 swiperParams['grabCursor'] = true; 4720 4721 if( $slider.attr('data-animationtype') == 'fade' ) { 4722 swiperParams['fadeEffect'] = { crossFade: true }; 4723 swiperParams['centeredSlides'] = true; 4724 } 4725 4726 } 4727 4728 if( $slider.attr('data-autoheight') == '1' ) { 4729 swiperParams['autoHeight'] = true; 4730 } 4731 4732 swipers[i] = new Swiper('.'+swiperClass, swiperParams); 4733 4734 swipers[i].on('slideChange', function () { 4735 $(window).trigger('scroll'); 4736 }); 4737 4738 if( ($slider.attr('data-animationtype') == 'cube' || $slider.attr('data-animationtype') == 'flip' || $slider.attr('data-animationtype') == 'cards' ) && $slider.closest('.mfn-looped-items-slider-wrapper').hasClass('mfn-arrows-standard') ) { 4739 let sw_arr_wi = $slider.closest('.mfn-looped-items-slider-wrapper').find('.mfn-swiper-arrow').outerWidth()+'px'; 4740 $('body').append('<style>.mfn-ql-slider-'+i+'{ --mfn-swiper-arrow-width: '+sw_arr_wi+' }</style>') 4741 $(window).trigger('resize'); 4742 } 4743 4744 }); 4745 } 4746 4747 // Slider | Slider 4748 4749 function sliderSlider() { 4750 4751 var pager = function(el, i) { 4752 return '<a>' + i + '</a>'; 4753 }; 4754 4755 $('.content_slider_ul').each(function() { 4756 4757 var slider = $(this); 4758 var count = 1; 4759 var centerMode = false; 4760 4761 if (slider.closest('.content_slider').hasClass('carousel')) { 4762 count = slickAutoResponsive(slider); 4763 4764 $(window).on('debouncedresize', function() { 4765 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider), false); 4766 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider), true); 4767 }); 4768 } 4769 4770 if (slider.closest('.content_slider').hasClass('center')) { 4771 centerMode = true; 4772 } 4773 4774 slider.slick({ 4775 cssEase: 'cubic-bezier(.4,0,.2,1)', 4776 dots: true, 4777 infinite: true, 4778 touchThreshold: 10, 4779 speed: 300, 4780 4781 centerMode: centerMode, 4782 centerPadding: '20%', 4783 4784 prevArrow: '<a class="button the-icon slider_prev" href="#" aria-label="previous slide"><i class="icon-left-open-big"></i></a>', 4785 nextArrow: '<a class="button the-icon slider_next" href="#" aria-label="next slide"><i class="icon-right-open-big"></i></a>', 4786 4787 adaptiveHeight: true, 4788 appendDots: slider.siblings('.slider_pager'), 4789 customPaging: pager, 4790 4791 rtl: rtl ? true : false, 4792 autoplay: mfn.slider.slider ? true : false, 4793 autoplaySpeed: mfn.slider.slider ? mfn.slider.slider : 5000, 4794 4795 slidesToShow: count, 4796 slidesToScroll: count 4797 }); 4798 4799 // Lightbox | disable on dragstart 4800 4801 var clickEvent = false;
4802 4803 slider.on('dragstart', '.slick-slide a[rel="lightbox"]', function(event) { 4804 if (lightboxAttr) { 4805 var events = $._data(this,'events'); 4806 if( events && Object.prototype.hasOwnProperty.call(events, 'click') ) { 4807 clickEvent = events.click[0]; 4808 $(this).addClass('off-click').off('click'); 4809 } 4810 } 4811 }); 4812 4813 // Lightbox | enable after change 4814 4815 slider.on('afterChange', function(event, slick, currentSlide, nextSlide) { 4816 if (lightboxAttr) { 4817 $('a.off-click[rel="lightbox"]', slider).removeClass('off-click').on('click', clickEvent); 4818 } 4819 }); 4820 4821 }); 4822 } 4823 4824 // Slider | Testimonials 4825 4826 function sliderTestimonials() { 4827 4828 var pager = function(el, i) { 4829 var img = $(el.$slides[i]).find('.single-photo-img').html(); 4830 return '<a>' + img + '</a>'; 4831 }; 4832 4833 $('.testimonials_slider_ul').each(function() { 4834 4835 var slider = $(this); 4836 4837 slider.slick({ 4838 cssEase: 'ease-out', 4839 dots: true, 4840 infinite: true, 4841 touchThreshold: 10, 4842 speed: 300, 4843 4844 prevArrow: '<a class="button the-icon slider_prev" href="#" aria-label="previous slide"><i class="icon-left-open-big"></i></a>', 4845 nextArrow: '<a class="button the-icon slider_next" href="#" aria-label="next slide"><i class="icon-right-open-big"></i></a>', 4846 4847 adaptiveHeight: true, 4848 appendDots: slider.siblings('.slider_pager'), 4849 customPaging: pager, 4850 4851 rtl: rtl ? true : false, 4852 autoplay: mfn.slider.testimonials ? true : false, 4853 autoplaySpeed: mfn.slider.testimonials ? mfn.slider.testimonials : 5000, 4854 4855 slidesToShow: 1, 4856 slidesToScroll: 1 4857 }); 4858 4859 }); 4860 } 4861 4862 /** 4863 * 4864 * Tabber 4865 * 4866 * */ 4867 4868 let mfnTabber = { 4869 init: function() { 4870 4871 $(document).on('mouseover', '.mfn-tabber-open-on-hover .mfn-tabber-nav li a', function(e) { 4872 4873 if( !$(this).parent('li').hasClass('active') ) { 4874 4875 let tab = $(this).attr('data-tab'); 4876 4877 $(this).parent('li').siblings('li').removeClass('active'); 4878 $(this).closest('.mfn-section-tabber').find('.mfn-tabber-content.active').removeClass('active'); 4879 4880 $(this).parent('li').addClass('active'); 4881 $(this).closest('.mfn-section-tabber').find(tab).addClass('active'); 4882 4883 $(document).trigger('mfn:tabber:open'); 4884 $(window).trigger('resize'); 4885 4886 } 4887 4888 }).on('click', '.mfn-tabber-nav li a', function(e) { 4889 4890 if( !$(this).parent('li').hasClass('active') ) { 4891 e.preventDefault(); 4892 let tab = $(this).attr('data-tab'); 4893 4894 $(this).parent('li').siblings('li').removeClass('active'); 4895 $(this).closest('.mfn-section-tabber').find('.mfn-tabber-content.active').removeClass('active'); 4896 4897 $(this).parent('li').addClass('active'); 4898 $(this).closest('.mfn-section-tabber').find(tab).addClass('active'); 4899 4900 $(document).trigger('mfn:tabber:open'); 4901 $(window).trigger('resize'); 4902 4903 }else if( $(this).attr('href') == '#' || $('body').hasClass('mfn-ui') ) { 4904 e.preventDefault(); 4905 } 4906 4907 }); 4908 4909 if( $('body').hasClass('mfn-ui') ){ 4910 setTimeout(mfnTabber.sliding_bg, 800); // must have 4911 }else{ 4912 setTimeout(mfnTabber.sliding_bg, 300); // must have 4913 } 4914 4915 }, 4916 4917 sliding_bg: function() { 4918 4919 if( !$('.mfn-tabber-nav.mfn-tabber-nav-hover-sliding').length ) return; 4920 4921 $('.mfn-tabber-nav.mfn-tabber-nav-hover-sliding').each(function() { 4922 let wrapper = $(this); 4923 let li = wrapper.find('li.active'); 4924 let helper = wrapper.find('.mfn-tabber-nav-slide-helper'); 4925 4926 let offset_left = li.position().left; 4927 let offset_top = li.position().top; 4928 4929 helper.css({ top: offset_top, left: offset_left, width: li.outerWidth(), height: li.outerHeight() }); 4930 4931 }); 4932 4933 $('.mfn-tabber-open-on-click .mfn-tabber-nav.mfn-tabber-nav-hover-sliding li').on('click', function() { 4934 let li = $(this); 4935 let helper = li.closest('ul').find('.mfn-tabber-nav-slide-helper'); 4936 4937 let offset_left = li.position().left; 4938 let offset_top = li.position().top; 4939 4940 helper.css({ top: offset_top, left: offset_left, width: li.outerWidth(), height: li.outerHeight() }); 4941 }); 4942 4943 $('.mfn-tabber-open-on-hover .mfn-tabber-nav.mfn-tabber-nav-hover-sliding li').on('mouseover', function() { 4944 let li = $(this); 4945 let helper = li.closest('ul').find('.mfn-tabber-nav-slide-helper'); 4946 4947 let offset_left = li.position().left; 4948 let offset_top = li.position().top; 4949 4950 helper.css({ top: offset_top, left: offset_left, width: li.outerWidth(), height: li.outerHeight() }); 4951 }); 4952 4953 if( $('.mfn-tabber-nav.mfn-tabber-nav-hover-sliding li.active').length ){ 4954 4955 $('.mfn-tabber-nav.mfn-tabber-nav-hover-sliding li.active') 4956 4957 } 4958 4959 } 4960 4961 } 4962 4963 /** 4964 * 4965 * Filters 4966 * 4967 * */ 4968 4969 let mfnAdvancedFilters = { 4970 form: false, 4971 init: function() { 4972 if( !$('.mfn-advanced-filters').length ) return; 4973 4974 this.prepare(); 4975 4976 $(document).on('click', '.mfn-advanced-filters .mfn-advanced-filters-expand', function(e) { 4977 e.preventDefault(); 4978 4979 if( $(this).hasClass('mfn-expanded') ){ 4980 $(this).removeClass('mfn-expanded'); 4981 $(this).text($(this).attr('data-more')); 4982 $(this).closest('.mfn-form-row-wrapper').find('li.mfn-opt-expandable').addClass('mfn-opt-hidden').removeClass('mfn-opt-expandable'); 4983 }else{ 4984 $(this).addClass('mfn-expanded'); 4985 $(this).text($(this).attr('data-less')); 4986 $(this).closest('.mfn-form-row-wrapper').find('li.mfn-opt-hidden').removeClass('mfn-opt-hidden').addClass('mfn-opt-expandable'); 4987 } 4988 }); 4989 4990 $(document).on('click', '.mfn-advanced-filters-accordion .mfn-advanced-filters-group-label', function(e) { 4991 e.preventDefault(); 4992 let row = $(this).closest('.mfn-form-row'); 4993 if( row.hasClass('open') ){ 4994 row.removeClass('open'); 4995 $(this).siblings('.mfn-form-row-wrapper').slideUp(300); 4996 }else{ 4997 row.addClass('open'); 4998 $(this).siblings('.mfn-form-row-wrapper').slideDown(300); 4999 } 5000 5001 }) 5002 5003 if( $('.mfn-advanced-filters .mfn-advanced-filters-rate') ){ 5004 $(document).on('click', '.mfn-advanced-filters .mfn-advanced-filters-rate li', function() { 5005 $(this).toggleClass('active'); 5006 5007 let helper_arr = []; 5008 5009 $(this).closest('.mfn-advanced-filters-rate').find('li.active').each(function(el) { 5010 helper_arr.push($(this).attr('data-rate')); 5011 }); 5012 5013 $(this).closest('.mfn-advanced-filters-rate').find('.mfn-advanced-rate-input').val(helper_arr.join(',')).trigger('change'); 5014 5015 }); 5016 } 5017 5018 $(document).on('change', 'form.mfn-active-filters input', function(e) { 5019 mfnAdvancedFilters.ajax($(this).closest('form')); 5020 }); 5021 5022 $(document).on('change', 'form.mfn-advanced-filters-auto-submit input, form.mfn-advanced-filters-auto-submit select', function(e) { 5023 mfnAdvancedFilters.ajax($(this).closest('form')); 5024 }).on('submit', 'form.mfn-advanced-filters-auto-submit', function(e) { 5025 e.preventDefault(); 5026 mfnAdvancedFilters.ajax($(this)); 5027 }); 5028 5029 $(document).on('submit', 'form.mfn-advanced-filters-ajax-submit', function(e) { 5030 e.preventDefault(); 5031 mfnAdvancedFilters.ajax($(this)); 5032 }); 5033 5034 $(document).on('click', '.mfn-active-filters .mfn-reset-filters', function(e) { 5035 e.preventDefault(); 5036 $(this).closest('form').empty(); 5037 mfnAdvancedFilters.ajax($(this).closest('form')); 5038 }); 5039 5040 }, 5041 5042 prepare: function() { 5043 5044 if( $('.mfn-active-filters .mfn-active-filters-find-title').length ) { 5045 $('.mfn-active-filters .mfn-active-filters-find-title:not(.initialized)').each(function(i, el) { 5046 5047 $(el).addClass('initialized'); 5048 5049 let selector = '[name="'+$(el).find('input').attr('name')+'"]'; 5050 let searched_input = $('.mfn-advanced-filters '+selector); 5051 if( $(el).find('input').val().length ) { 5052 5053 let label = searched_input.closest('.mfn-form-row').find('.mfn-advanced-filters-label-name').length ? searched_input.closest('.mfn-form-row').find('.mfn-advanced-filters-label-name').first().text() : ''; 5054 5055 if( typeof searched_input.attr('placeholder') != 'undefined' && searched_input.closest('.mfn-floating-placeholder').length ) { 5056 if( label.length ) $(el).append(label+' '); 5057 $(el).append(searched_input.attr('placeholder')+': '+$(el).find('input').val()); 5058 }else if( searched_input.hasClass('mfn-advanced-rate-input') && label.length ) { 5059 if( label.length ) $(el).append(label+': '); 5060 $(el).append($(el).find('input').val()); 5061 }else{ 5062 $(el).append(searched_input.closest('.mfn-form-row').find('.mfn-advanced-filters-group-label h4').first().text()+': '+$(el).find('input').val()); 5063 } 5064 5065 }else{ 5066 $(el).remove(); 5067 } 5068 }); 5069 } 5070
5071 $('.mfn-advanced-filters:not(.initialized)').each(function(i, el) { 5072 mfnAdvancedFilters.form = $(el); 5073 mfnAdvancedFilters.form.addClass('initialized'); 5074 5075 if( mfnAdvancedFilters.form.find('.mfn-advanced-filters-slider').length ){ 5076 mfnAdvancedFilters.slider(); 5077 } 5078 5079 if( mfnAdvancedFilters.form.find('.mfn-advanced-filters-range-slider').length ){ 5080 mfnAdvancedFilters.slider_range(); 5081 } 5082 }); 5083 }, 5084 5085 ajax: ($form) => { 5086 5087 var url = $form.attr('action') || location.origin + location.pathname; 5088 var method = ($form.attr('method') || 'GET').toUpperCase(); 5089 var data = $form.serialize(); 5090 5091 if( $form.closest('.mfn-sidemenu-tmpl.mfn-sidemenu-active').length ) { 5092 $form.closest('.mfn-sidemenu-tmpl.mfn-sidemenu-active').find('.mfn-sidemenu-closebutton').trigger('click'); 5093 } 5094 5095 // UX: spinner/wyłączenie pól (opcjonalnie) 5096 var $content = $('#Content'); 5097 $content.addClass('is-loading'); // zrób w CSS np. półprzezroczystość 5098 $form.find('input,select,button').prop('disabled', true); 5099 $form.find('button.mfn-btn').addClass('loading disabled'); 5100 5101 if( $('.mfn-archive-product-tmpl-builder .mfn-woo-list-perpage li.active input').length && $('.mfn-archive-product-tmpl-builder .mfn-woo-list-perpage li.active input').val().length ) data += '&per_page='+$('.mfn-archive-product-tmpl-builder .mfn-woo-list-perpage li.active input').val(); 5102 if( $('.mfn-archive-product-tmpl-builder .woocommerce-ordering select').length && $('.mfn-archive-product-tmpl-builder .woocommerce-ordering select').val().length ) data += '&orderby='+$('.mfn-archive-product-tmpl-builder .woocommerce-ordering select').val(); 5103 if( $('.mfn-archive-product-tmpl-builder .mfn-woo-list-style li.active input').length && $('.mfn-archive-product-tmpl-builder .mfn-woo-list-style li.active input').val().length ) data += '&layout='+$('.mfn-archive-product-tmpl-builder .mfn-woo-list-style li.active input').val(); 5104 5105 $.ajax({ 5106 url: url, 5107 type: method, 5108 data: data, 5109 dataType: 'html' 5110 }).done(function(html){ 5111 var $html = $('<div>').append($.parseHTML(html)); 5112 var $newContent = $html.find('#Content'); 5113 5114 if ($newContent.length) { 5115 $content.replaceWith($newContent); 5116 5117 if( $('.mfn-sidemenu-tmpl').length ) { 5118 $('.mfn-sidemenu-tmpl').each(function() { 5119 let id = $(this).attr('id'); 5120 $(this).replaceWith($html.find('#'+id)); 5121 }); 5122 } 5123 5124 if (method === 'GET') { 5125 var newUrl = url + (url.indexOf('?')>-1 ? '&' : '?') + data; 5126 window.history.replaceState({}, '', newUrl); 5127 } 5128 } else { 5129 window.location.href = method==='GET' ? (url + (url.indexOf('?')>-1?'&':'?') + data) : url; 5130 } 5131 }).fail(function(){ 5132 window.location.href = method==='GET' ? (url + (url.indexOf('?')>-1?'&':'?') + data) : url; 5133 }).always(function(){ 5134 $form.find('input,select,button').prop('disabled', false); 5135 $('#Content').removeClass('is-loading'); 5136 $form.find('button.mfn-btn').removeClass('loading disabled'); 5137 5138 $(document).trigger('mfn:ajax:refresh'); 5139 }); 5140 }, 5141 5142 slider: function() { 5143 mfnAdvancedFilters.form.find('.mfn-advanced-filters-slider').each(function(i, slider) { 5144 5145 let input = $(this).closest('.mfn-form-row-wrapper').find('input.mfn-ui-slider-input'); 5146 5147 let min = input.attr('min').length ? input.attr('min') : '0'; 5148 let max = input.attr('max').length ? input.attr('max') : '500'; 5149 5150 let val = input.val().length ? input.val() : ''; 5151 5152 $(this).slider({ 5153 step: 1, 5154 min: parseFloat(min), 5155 max: parseFloat(max), 5156 range: "min", 5157 value: val, 5158 create: function () { 5159 $(this).find(".ui-slider-handle").append('<span class="mfn-ui-tip"></span>'); 5160 $(this).find(".mfn-ui-tip").text($(this).slider("value")); 5161 }, 5162 slide: function( event, ui ) { 5163 input.val(ui.value); 5164 if( !input.parent('.mfn-input-wrapper').hasClass('mfn-not-empty') ) input.parent('.mfn-input-wrapper').addClass('mfn-not-empty'); 5165 $(this).find(".mfn-ui-tip").text(ui.value); 5166 }, 5167 stop: function() { 5168 input.trigger('change'); 5169 } 5170 }); 5171 5172 }); 5173 }, 5174 5175 slider_range: function() { 5176 mfnAdvancedFilters.form.find('.mfn-advanced-filters-range-slider').each(function(i, slider) { 5177 5178 let input_min = $(this).closest('.mfn-advanced-filters-slider-wrapper').find('input.mfn-ui-slider-input-min'); 5179 let input_max = $(this).closest('.mfn-advanced-filters-slider-wrapper').find('input.mfn-ui-slider-input-max'); 5180 5181 let min = typeof input_min.attr('min') != 'undefined' ? input_min.attr('min') : '0'; 5182 let max = typeof input_max.attr('max') != 'undefined' ? input_max.attr('max') : '500'; 5183 5184 let val_min = input_min.val().length ? input_min.val() : min; 5185 let val_max = input_max.val().length ? input_max.val() : max; 5186 5187 $(this).slider({ 5188 range: true, 5189 step: 1, 5190 min: parseFloat(min), 5191 max: parseFloat(max), 5192 values: [ parseFloat(val_min), parseFloat(val_max) ], 5193 create: function (event, ui) { 5194 $(this).find(".ui-slider-handle").append('<span class="mfn-ui-tip"></span>'); 5195 $(this).find(".mfn-ui-tip").first().text(val_min); 5196 $(this).find(".mfn-ui-tip").last().text(val_max); 5197 }, 5198 slide: function( event, ui ) { 5199 $(ui.handle).closest('.mfn-form-row-wrapper').find('input.mfn-ui-slider-input-min').val(ui.values[ 0 ]); 5200 $(ui.handle).closest('.mfn-form-row-wrapper').find('input.mfn-ui-slider-input-max').val(ui.values[ 1 ]); 5201 5202 if( !$(ui.handle).closest('.mfn-form-row-wrapper').find('.mfn-input-wrapper').hasClass('mfn-not-empty') ) $(ui.handle).closest('.mfn-form-row-wrapper').find('.mfn-input-wrapper').addClass('mfn-not-empty'); 5203 5204 $(ui.handle).find(".mfn-ui-tip").text(ui.value); 5205 }, 5206 stop: function() { 5207 input_min.trigger('change'); 5208 } 5209 }); 5210 5211 }); 5212 } 5213 } 5214 5215 /** 5216 * GDPR 5217 */ 5218 5219 // GDPR | Close notice on click | BIND 5220 5221 $(document).on('click', '.mfn-gdpr-button', function(){ 5222 var closeAnimation = $('.mfn-gdpr-button').attr('data-animation'); 5223 var barAligment = $('#mfn-gdpr').attr('data-aligment'); 5224 5225 switch(true){ 5226 case 'none' === closeAnimation: 5227 $('#mfn-gdpr').css('display', 'none'); 5228 break; 5229 case 'fade' === closeAnimation: 5230 $('#mfn-gdpr').fadeOut(300); 5231 break; 5232 case 'slide' === closeAnimation && 'top' === barAligment: 5233 $('#mfn-gdpr').slideUp(300); 5234 break; 5235 default: 5236 $('#mfn-gdpr').slideToggle(300); 5237 break; 5238 } 5239 5240 // wait for animation end, then remove clasa and set cookies 5241 setTimeout(function(){ 5242 $('#mfn-gdpr').removeClass('show'); 5243 gdpr_set_cookie(); 5244 }, 300); 5245 }); 5246 5247 // GDPR | Set the cookie 5248 5249 function gdpr_set_cookie(){ 5250 if(navigator.cookieEnabled) { 5251 var cookieDays = $('.mfn-gdpr-button').attr('data-cookiedays') || 365; 5252 var cookieDate = new Date(); 5253 var cookieText = ''; 5254 5255 cookieDate.setTime(cookieDate.getTime() + (cookieDays * 24 * 60 * 60 * 1000)); 5256 cookieText += "mfn-gdpr=1"; 5257 cookieText += "; expires=" + cookieDate.toUTCString() + ';'; 5258 cookieText += "; path=" + mfn.home_url + '/'; 5259 5260 document.cookie = cookieText; 5261 } 5262 } 5263 5264 // GDPR | Display, if cookie not accepted 5265 5266 function gdpr(){ 5267 if (document.cookie !== "") { 5268 var cookies = document.cookie.split(/; */); 5269 5270 for (var cookie of cookies) { 5271 var [ cookieName ] = cookie.split("="); 5272 5273 if (cookieName === 'mfn-gdpr') { 5274 return; // cookie exists 5275 } 5276 } 5277 } 5278 5279 $('#mfn-gdpr').addClass('show'); //cookie does NOT exist 5280 } 5281 5282 /* 5283 * Infinite scroll functionality 5284 */ 5285 5286 function infiniteScrollFunction(infiniteLoadContainer, infiniteLoadButton, scrollDirection){ 5287 5288 // for proper check, if we need to fetch posts again. 5289 var screenHeight = document.body.clientHeight; 5290 5291 if ( infiniteLoadContainer.attr('data-attr') === $(infiniteLoadButton).attr('href') ) { 5292 return; // it means, that maximum length of pages is crossed 5293 } else if (scrollDirection === 'down') { 5294 5295 // attach link for check, and click the load more button! 5296 infiniteLoadContainer.attr('data-attr', $(infiniteLoadButton).attr('href')); 5297 infiniteLoadButton.click(); 5298
5299 // prevention, when height did not change enought, load again 5300 setTimeout(function(){ 5301 var heightAfterLoadDifference = (document.body.clientHeight - screenHeight); 5302 5303 if( heightAfterLoadDifference < 249 ) { 5304 infiniteScrollFunction(infiniteLoadContainer, infiniteLoadButton, scrollDirection); 5305 } 5306 }, 500); 5307 5308 } 5309 } 5310 5311/* function infiniteScrollPortfolio(){ 5312 var infiniteLoadContainer = $('.mfn-infinite-load-button'); 5313 var infiniteLoadButton = $('.mfn-infinite-load-button a'); 5314 5315 $(infiniteLoadContainer).waypoint({ 5316 handler: function(direction) { 5317 infiniteScrollFunction(infiniteLoadContainer, infiniteLoadButton, direction); 5318 }, 5319 offset: function(){ 5320 //after each load, calc the offset of element to know when posts should be loaded 5321 var offsetPosition = - ( ($(this)[0].element.scrollHeight) - (window.innerHeight / 1.2) ); 5322 return offsetPosition; 5323 } 5324 }); 5325 5326 5327 } */ 5328 5329 /* 5330 * Table of Contents | toc 5331 */ 5332 5333 $('body').on('click', ".table_of_content .toggle", function(e){ 5334 5335 e.preventDefault(); 5336 5337 if( $('.table_of_content').hasClass('hide') ){ 5338 5339 $('.table_of_content').removeClass('hide'); 5340 5341 $('.table_of_content_wrapper').slideDown( { 5342 duration: 400, 5343 always: function(){ 5344 $('.table_of_content').removeClass('hide_on_start'); 5345 } 5346 }); 5347 5348 } else { 5349 5350 $('.table_of_content_wrapper').slideUp( { 5351 duration: 400 5352 }); 5353 5354 $('.table_of_content').addClass('hide'); 5355 5356 } 5357 5358 }); 5359 5360 function tableContentAttachId(){ 5361 const container = $('.table_of_content'); 5362 let tags; 5363 let anchorNumber = 0; 5364 let anchorDom = $('.table_of_content_wrapper').find('a'); 5365 5366 5367 if(tags = container.attr('data-tags')){ 5368 tags = tags.split(/[ ,]+/).join(','); //remove spaces, add commas 5369 5370 // muffin builder, gutenberg, elementor 5371 let columns = $('#Content .mfn-builder-content .column_column, #Content .mfn-builder-content .column_post_content, #Content .mfn-builder-content .column_heading, #Content .mfn-builder-content .column_fancy_heading, .the_content_wrapper:not(.is-elementor), .elementor-widget:not(.elementor-widget-mfn_table_of_contents)'); 5372 5373 if( $('#Content .mfn-single-post-tmpl-builder .column_post_content').length ){ 5374 columns = $('#Content .mfn-single-post-tmpl-builder .column_post_content .column_column, #Content .mfn-single-post-tmpl-builder .column_post_content, #Content .mfn-single-post-tmpl-builder .column_post_content .column_heading, #Content .mfn-single-post-tmpl-builder .column_post_content .column_fancy_heading, .the_content_wrapper:not(.is-elementor), .elementor-widget:not(.elementor-widget-mfn_table_of_contents)'); 5375 }else if( $('#Content .mfn-single-portfolio-tmpl-builder .column_post_content').length ){ 5376 columns = $('#Content .mfn-single-portfolio-tmpl-builder .column_post_content .column_column, #Content .mfn-single-portfolio-tmpl-builder .column_post_content, #Content .mfn-single-portfolio-tmpl-builder .column_post_content .column_heading, #Content .mfn-single-portfolio-tmpl-builder .column_post_content .column_fancy_heading, .the_content_wrapper:not(.is-elementor), .elementor-widget:not(.elementor-widget-mfn_table_of_contents)'); 5377 } 5378 5379 5380 $(columns).each( ( index, element ) => { 5381 let headingsNoticed = $(element).find(tags); //look for headings 5382 5383 $(headingsNoticed).each( ( index, element ) => { 5384 5385 if( $(element).attr('id') ) { //replace toc_X with user assigned ID 5386 5387 const idSet = '#'+$(element).attr('id'); 5388 $(anchorDom[anchorNumber]).attr('href', idSet ); 5389 5390 }else{ 5391 5392 let id = $(anchorDom[anchorNumber]).attr('href'); 5393 if(typeof id !== 'undefined') $(element).attr('id', id.substr(1) ); 5394 5395 } 5396 5397 anchorNumber++; 5398 }) 5399 5400 }) 5401 5402 } 5403 } 5404 5405 /** 5406 * Off-canvas sidebar 5407 */ 5408 5409 var offCanvasSidebar = { 5410 init: function() { 5411 $(document).on('click', '.mfn-off-canvas-switcher', function(e) { 5412 e.preventDefault(); 5413 if( $('html').hasClass('mfn-ofcs-opened') ){ 5414 $('html').removeClass('mfn-ofcs-opened'); 5415 }else{ 5416 $('html').addClass('mfn-ofcs-opened'); 5417 } 5418 }); 5419 }, 5420 mobile: function() { 5421 if( $('.sidebar .widget-area').length && $('body').hasClass('ofcs-mobile') ){ 5422 5423 if( !$('.mfn-off-canvas-sidebar').length ){ 5424 $('body').append('<div class="mfn-off-canvas-overlay"></div><div class="mfn-off-canvas-sidebar"><div class="mfn-off-canvas-switcher"><i class="icon-list" aria-label="off-canvas sidebar toggle"></i></div><div class="mfn-off-canvas-content-wrapper"><div class="mfn-off-canvas-content"></div></div></div>'); 5425 } 5426 5427 if( $('body').hasClass('woocommerce-shop') && !$('.mfn-woo-filters-wrapper .mfn-off-canvas-switcher').length ){ 5428 $('.mfn-woo-filters-wrapper').append('<a class="open-filters mfn-off-canvas-switcher" href="#"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" aria-label="off-canvas sidebar toggle"><defs><style>
5428.path{fill:none;stroke:#000;stroke-miterlimit:10;}</style></defs><g><line x1="8" y1="11" x2="14" y2="11" class="path"></line><line x1="2" y1="11" x2="4" y2="11" class="path"></line><line x1="12" y1="5" x2="14" y2="5" class="path"></line><line x1="2" y1="5" x2="8" y2="5" class="path"></line><circle cx="6" cy="11" r="2" class="path"></circle><circle cx="10" cy="5" r="2" class="path"></circle></g></svg></a>'); 5429 } 5430 5431 var $ofcs = $('.mfn-off-canvas-sidebar .mfn-off-canvas-content-wrapper .mfn-off-canvas-content'); 5432 $ofcs.empty(); 5433 5434 $('.sidebar .widget-area').each(function() { 5435 //var $sdbr = $(this).clone(true); 5436 $ofcs.append( $(this) ); 5437 //$(this).hide(); 5438 }); 5439 5440 offCanvasSidebar.init(); 5441 5442 } 5443 } 5444 } 5445 5446 function alignHeights(){ 5447 var i = 0; 5448 if( !$('.mfn-align-heights').length ) return; 5449 $('.mfn-align-heights').each(function() { 5450 var max=0; 5451 var newclass = 'mfn-align-cont-'+i; 5452 $(this).addClass(newclass); 5453 $("<style type='text/css'> ."+newclass+" .mfn-align-me{ height: auto;} </style>").appendTo("body"); 5454 $("."+newclass+" .mfn-align-me").each(function() { 5455 if($(this).outerHeight() > max){max = $(this).outerHeight();} 5456 }); 5457 $("<style type='text/css'> ."+newclass+" .mfn-align-me{ height: "+max+"px;} </style>").appendTo("body"); 5458 i++; 5459 }); 5460 } 5461 5462 $(window).on('debouncedresize', alignHeights); 5463 5464 var headerMegamenu = { 5465 init: function() { 5466 5467 if( $('.mfn-megamenu-menu.mfn-mm-submenu-toggled li.menu-item-has-children').length ){ 5468 $('.mfn-megamenu-menu.mfn-mm-submenu-toggled li.menu-item-has-children > a').on('click', function(e) { 5469 let href = $(this).attr('href'); 5470 if( !$(this).parent('li').hasClass('mfn-li-childrens-show') ){ 5471 e.preventDefault(); 5472 e.stopPropagation(); 5473 $(this).siblings('ul').slideDown(300); 5474 $(this).parent('li').addClass('mfn-li-childrens-show'); 5475 }else if( href == '' || href == '#' ){ 5476 e.preventDefault(); 5477 e.stopPropagation(); 5478 $(this).siblings('ul').slideUp(300); 5479 $(this).parent('li').removeClass('mfn-li-childrens-show'); 5480 } 5481 }); 5482 } 5483 5484 /** 5485 * Submenu in mega menu 5486 * */ 5487 5488 if( $('.column_megamenu_menu ul.mfn-mm-menu-horizontal.mfn-mm-submenu-on-click li').length ){ 5489 $('.column_megamenu_menu ul.mfn-mm-menu-horizontal.mfn-mm-submenu-on-click li > a').on('click', function(e) { 5490 if( $(this).closest('li').hasClass('menu-item-has-children') && !$(this).closest('li').hasClass('mfn-li-hover') ){ 5491 e.preventDefault(); 5492 e.stopPropagation(); 5493 $(this).closest('li').addClass('mfn-li-hover'); 5494 } 5495 }); 5496 } 5497 5498 if( $('ul.mfn-menu-submenu-on-hover li.mfn-menu-item-has-megamenu, li.mfn-theme-options-menu.mfn-menu-item-has-megamenu').length ){ 5499 $('ul.mfn-menu-submenu-on-hover li.mfn-menu-item-has-megamenu, li.mfn-theme-options-menu.mfn-menu-item-has-megamenu').on('mouseenter mousemove', function() { 5500 if( $(this).find('.mfn-megamenu-full-width').length || $(this).find('.mfn-megamenu-grid').length ){ 5501 headerMegamenu.setLeft($(this)); 5502 } 5503 }); 5504 } 5505 5506 if( $('ul.mfn-menu-submenu-on-click li.mfn-menu-item-has-megamenu').length ){ 5507 5508 $('ul.mfn-menu-submenu-on-click li.mfn-menu-item-has-megamenu > a.mfn-menu-link').on('click', function(e) { 5509 let href = $(this).attr('href'); 5510 5511 if( $(this).closest('li').find('.mfn-megamenu-full-width').length || $(this).closest('li').find('.mfn-megamenu-grid').length ){ 5512 headerMegamenu.setLeft($(this).closest('li')); 5513 } 5514 5515 if( href == '' || href == '#' ){ 5516 e.preventDefault(); 5517 e.stopPropagation(); 5518 if( $(this).closest('li').hasClass('mfn-li-hover') ) { 5519 $(this).closest('li').removeClass('mfn-li-hover'); 5520 $(document).unbind('click', headerTemplate.bindUnclick); 5521 $('body').removeClass('mfn-content-gray mfn-content-blur mfn-content-overlay'); 5522 }else{ 5523 $('ul.mfn-menu-submenu-on-click li.mfn-menu-item-has-megamenu.mfn-li-hover').removeClass('mfn-li-hover'); 5524 $(this).closest('li').addClass('mfn-li-hover'); 5525 $(document).bind('click', headerTemplate.bindUnclick); 5526 headerTemplate.animContentAddClass(); 5527 } 5528 }else if( !$(this).closest('li').hasClass('mfn-li-hover') ) { 5529 e.preventDefault(); 5530 e.stopPropagation(); 5531 if( !$(this).closest('li.mfn-li-hover').length ) { 5532 $('.mfn-header-tmpl ul li.mfn-li-hover').removeClass('mfn-li-hover'); 5533 }else if($(this).closest('li.mfn-li-hover').find('li.mfn-li-hover').length){ 5534 $(this).closest('li.mfn-li-hover').find('li.mfn-li-hover').removeClass('mfn-li-hover'); 5535 } 5536 if( !$(this).closest('.mfn-megamenu-menu').length && !$(this).closest('li.mfn-li-hover').length ) { 5537 if( $('.mfn-megamenu-menu.mfn-mm-submenu-toggled li.menu-item-has-children.mfn-li-childrens-show').length ){ 5538 $('.mfn-megamenu-menu.mfn-mm-submenu-toggled li.menu-item-has-children.mfn-li-childrens-show ul').slideUp(); 5539 $('.mfn-megamenu-menu.mfn-mm-submenu-toggled li.menu-item-has-children.mfn-li-childrens-show').removeClass('mfn-li-childrens-show'); 5540 } 5541 } 5542 headerTemplate.animContentAddClass(); 5543 $(this).parent('li').addClass('mfn-li-hover'); 5544 $(document).bind('click', headerTemplate.bindUnclick); 5545 } 5546 5547 headerMegamenu.afterShow(); 5548 5549 }); 5550 5551 } 5552 5553 }, 5554 5555 afterShow: function() { 5556 bannerBox.init(); 5557 $(window).trigger('resize'); 5558 }, 5559 5560 setLeft: function($li) { 5561 var $mm = $li.find('.mfn-menu-item-megamenu'); 5562 var left = $li.offset().left; 5563 $mm.css('width', $(window).width()+'px'); 5564 $mm.css('left', '-'+left+'px'); 5565 $mm.addClass('mfn-mm-grid-set'); 5566 } 5567 } 5568 5569 var footerTemplate = { 5570 init: function() { 5571 if( !$('.mfn-footer-tmpl').length ) return; 5572 if( $('body').hasClass('mfn-footer-stick') ){ 5573 footerTemplate.isSticky(); 5574 } 5575 if( $('body').hasClass('mfn-footer-sliding') || $('body').hasClass('mfn-footer-fixed') ){ 5576 setTimeout(footerTemplate.isSliding(), 300); 5577 } 5578 return; 5579 }, 5580 isSticky: function() { 5581 if( !$('.mfn-footer-tmpl').length ) return; 5582 var offsetTop = $('.mfn-footer-tmpl').offset().top + $('.mfn-footer-tmpl').outerHeight(); 5583 if( offsetTop < $(window).height() ){ 5584 $('.mfn-footer-tmpl').addClass('is-sticky'); 5585 }else{ 5586 $('.mfn-footer-tmpl').removeClass('is-sticky'); 5587 } 5588 },
5589 isSliding: function() { 5590 var footer = $('.mfn-footer-tmpl').outerHeight(); 5591 $('#Content').css('margin-bottom', footer); 5592 } 5593 } 5594 5595 var bannerBox = { 5596 init: function(){ 5597 // bannerBox.init() 5598 setTimeout( bannerBox.set, 300 ); 5599 }, 5600 5601 set: function() { 5602 5603 if( $('body').hasClass('mfn-ui') ) return; 5604 5605 if( !$('.column_banner_box .hidden-desc').length ) return; 5606 5607 if( $(".mfn-banner-box .last-visible-el").length ) { 5608 $(".mfn-banner-box .last-visible-el").removeClass('last-visible-el'); 5609 $('.hidden-wrapper .hidden-desc').removeAttr('style'); 5610 } 5611 5612 $( ".mfn-banner-box").each(function() { 5613 5614 if( $(this).find('.hidden-desc').length ) { 5615 if( $(this).find('.hidden-desc').prev().length ) $(this).find('.hidden-desc').prev().addClass("last-visible-el"); 5616 5617 var hd_h = $(this).find('.hidden-wrapper').outerHeight(); 5618 $(this).find('.hidden-desc').css( { '--mfn-banner-box-height': hd_h + 'px' } ); 5619 } 5620 5621 }); 5622 5623 } 5624 5625 }; 5626 5627 5628 var mfn_hotspot = { 5629 init: function() { 5630 5631 if( $(window).width() >= 960 ){ 5632 mfn_hotspot.hover(); 5633 }else{ 5634 mfn_hotspot.click(); 5635 } 5636 5637 }, 5638 5639 hover: function(e) { 5640 $('.mfn-image-hotspot .hotspot-point').on('mouseenter', function() { 5641 $(this).addClass('is-active'); 5642 }).on('mouseleave', function() { 5643 $(this).removeClass('is-active'); 5644 }); 5645 5646 $('.mfn-image-hotspot').on('mouseleave', function() { 5647 $('.mfn-image-hotspot .hotspot-point.is-active').removeClass('is-active'); 5648 }); 5649 5650 }, 5651 5652 click: function() { 5653 $('.mfn-image-hotspot .hotspot-point').on('click', function() { 5654 if( $('.mfn-image-hotspot .hotspot-point.is-active').length ) $('.mfn-image-hotspot .hotspot-point.is-active').removeClass('is-active'); 5655 $(this).addClass('is-active'); 5656 $(document).bind('click', mfn_hotspot.bindUnclick); 5657 }) 5658 }, 5659 5660 bindUnclick: function(e) { 5661 if (!$('.mfn-image-hotspot .hotspot-point').is(e.target) && $('.mfn-image-hotspot .hotspot-point').has(e.target).length === 0) { 5662 if( $('.mfn-image-hotspot .hotspot-point.is-active').length ) $('.mfn-image-hotspot .hotspot-point.is-active').removeClass('is-active'); 5663 $(document).unbind('click', mfn_hotspot.bindUnclick); 5664 } 5665 } 5666 }; 5667 5668 5669 var headerTemplate = { 5670 hasSticky: false, 5671 isMobile: false, 5672 offsetScroll: 60, 5673 hasBodyOffset: false, 5674 height: 0, 5675 type: 'default', 5676 animContentOnHover: function() { 5677 5678 if( $('.mfn-header-tmpl.mfn-header-main .mfn-header-menu.mfn-header-mainmenu').hasClass('mfn-menu-submenu-on-hover') ){ 5679 $('.mfn-header-tmpl.mfn-header-main .mfn-header-menu.mfn-header-mainmenu.mfn-menu-submenu-on-hover > li.mfn-menu-item-has-megamenu, .mfn-header-tmpl.mfn-header-main .mfn-header-menu.mfn-header-mainmenu.mfn-menu-submenu-on-hover > li.menu-item-has-children').on('mouseenter mousemove', function() { 5680 headerTemplate.animContentAddClass(); 5681 }).on('mouseenter', function() { 5682 $(window).trigger('resize'); 5683 }); 5684 } 5685 5686 $('.mfn-header-tmpl.mfn-header-main .mfn-header-menu.mfn-header-mainmenu.mfn-menu-submenu-on-hover > li.mfn-menu-item-has-megamenu, .mfn-header-tmpl.mfn-header-main .mfn-header-menu.mfn-header-mainmenu.mfn-menu-submenu-on-hover > li.menu-item-has-children').on('mouseleave', function() { 5687 $('body').removeClass('mfn-content-gray mfn-content-blur mfn-content-overlay'); 5688 }); 5689 5690 }, 5691 animContentAddClass: function() { 5692 if( $('.mfn-header-tmpl.mfn-header-main').hasClass('mfn-header-content-blur') ) { 5693 $('body').addClass('mfn-content-blur'); 5694 }else if( $('.mfn-header-tmpl.mfn-header-main').hasClass('mfn-header-content-gray') ) { 5695 $('body').addClass('mfn-content-gray'); 5696 }else if( $('.mfn-header-tmpl.mfn-header-main').hasClass('mfn-header-content-overlay') ) { 5697 $('body').addClass('mfn-content-overlay'); 5698 } 5699 }, 5700 openOnClick: function() { 5701 5702 // common 5703 $(document).on('click', '.mfn-header-tmpl .mfn-header-menu.mfn-menu-submenu-on-click li.menu-item-has-children > a.mfn-menu-link', function(e) { 5704 let href = $(this).attr('href'); 5705 5706 if( $(this).closest('li').find('.mfn-megamenu-full-width').length || $(this).closest('li').find('.mfn-megamenu-grid').length ) { 5707 headerMegamenu.setLeft($(this).closest('li')); 5708 } 5709 5710 if( href == '' || href == '#' ){ 5711 e.preventDefault(); 5712 e.stopPropagation(); 5713 if( $(this).closest('li').hasClass('mfn-li-hover') ) { 5714 $(this).closest('li').removeClass('mfn-li-hover'); 5715 $(document).unbind('click', headerTemplate.bindUnclick); 5716 $('body').removeClass('mfn-content-gray mfn-content-blur mfn-content-overlay'); 5717 }else{ 5718 $(this).closest('li').siblings('li').removeClass('mfn-li-hover'); 5719 $(this).closest('li').addClass('mfn-li-hover'); 5720 $(document).bind('click', headerTemplate.bindUnclick); 5721 headerTemplate.animContentAddClass(); 5722 } 5723 }else if( !$(this).closest('li').hasClass('mfn-li-hover') ){ 5724 e.preventDefault(); 5725 e.stopPropagation(); 5726 $(this).closest('li').siblings('li').removeClass('mfn-li-hover'); 5727 headerTemplate.animContentAddClass(); 5728 $(this).parent('li').addClass('mfn-li-hover'); 5729 $(document).bind('click', headerTemplate.bindUnclick); 5730 } 5731 5732 5733 $(window).trigger('resize') 5734 }); 5735 5736 }, 5737 bindUnclick: function(e) { 5738 var $li = $('.mfn-header-tmpl ul li.mfn-li-hover'); 5739 if (!$li.is(e.target) && !$li.find(e.target).length ) { 5740 $li.removeClass('mfn-li-hover'); 5741 $('body').removeClass('mfn-content-gray mfn-content-blur mfn-content-overlay'); 5742 $(document).unbind('click', headerTemplate.bindUnclick); 5743 } 5744 }, 5745 closeable: function() { 5746 // common 5747 5748 if( $('body').hasClass('mfn-ui') ) return; 5749 5750 $('.mfn-header-tmpl .close-closeable-section').on('click', function() { 5751 var $section = $(this).closest('.mcb-section');
5752 $section.addClass('closeable-hidden').slideUp(300, function() { 5753 headerTemplate.resetOffset(); 5754 headerTemplate.offset(); 5755 }); 5756 5757 if( typeof $section.attr('data-close-days') !== 'undefined' && $section.attr('data-close-days') != '0' ){ 5758 var days = $section.attr('data-close-days'); 5759 var uid = $section.attr('data-uid'); 5760 var date=new Date(); 5761 date.setTime(date.getTime()+(parseInt(days)*24*60*60*1000)); 5762 var expires="; expires="+date.toGMTString(); 5763 document.cookie="mfn_closed_section_"+uid+"=1"+expires+"; path=/" 5764 } 5765 5766 }); 5767 }, 5768 resetOffset: function() { 5769 if( headerTemplate.type != 'default' && headerTemplate.hasBodyOffset ){ 5770 $('#Wrapper').css({ 'padding-top': $('.mfn-header-tmpl').outerHeight() }); 5771 } 5772 }, 5773 5774 detectHover: function() { 5775 $('.mfn-header-tmpl .mfn-menu-submenu-on-hover .mfn-menu-item-has-megamenu.mfn-menu-li').on('mouseenter', function() { 5776 headerMegamenu.afterShow(); 5777 }); 5778 5779 }, 5780 5781 offset: function() { 5782 if( headerTemplate.hasSticky && !headerTemplate.isMobile ) return; 5783 headerTemplate.offsetScroll = 0; 5784 var _screen = 'default'; 5785 if( headerTemplate.isMobile ) _screen = 'header-mobile'; 5786 $('.mfn-header-tmpl .mfn-'+_screen+'-section.hide-on-scroll:not(.closeable-hidden)').each(function() { 5787 headerTemplate.offsetScroll += $(this).outerHeight(); 5788 }); 5789 }, 5790 init: function() { 5791 headerTemplate.hasBodyOffset = false; 5792 5793 if( !$('body').hasClass('mfn-ui') && $('.mfn-header-tmpl').find('.section.closeable-active').length ) { 5794 $('.mfn-header-tmpl').find('.section.closeable-active').each(function() { 5795 if( headerTemplate.readcookie( 'mfn_closed_section_'+$(this).attr('data-uid') ) || headerTemplate.readcookie( 'mfn_closed_section' ) == $(this).attr('data-uid') ) { 5796 $(this).remove(); 5797 }else{ 5798 $(this).removeClass('mfn-temporary-hidden'); 5799 } 5800 }); 5801 } 5802 5803 if( $(window).width() < 767 && $('.mfn-header-tmpl').hasClass('mfn-hasMobile') ){ 5804 headerTemplate.isMobile = true; 5805 headerTemplate.type = $('.mfn-header-tmpl').attr('data-mobile-type'); 5806 if( $('.mfn-header-tmpl').hasClass('mfn-mobile-header-body-offset') ) { 5807 headerTemplate.hasBodyOffset = true; 5808 }else{ 5809 headerTemplate.hasBodyOffset = false; 5810 } 5811 }else{ 5812 headerTemplate.isMobile = false; 5813 headerTemplate.type = $('.mfn-header-tmpl').attr('data-type'); 5814 if( $('.mfn-header-tmpl').hasClass('mfn-header-body-offset') ) { 5815 headerTemplate.hasBodyOffset = true; 5816 }else{ 5817 headerTemplate.hasBodyOffset = false; 5818 } 5819 } 5820 5821 // init submenu show on click 5822 if( $('.mfn-header-tmpl .mfn-menu-submenu-on-click:not(.initialized)').length ) { 5823 $('.mfn-header-tmpl .mfn-menu-submenu-on-click').addClass('initialized'); 5824 headerTemplate.openOnClick(); 5825 } 5826 5827 if( $('.mfn-header-tmpl .mfn-menu-submenu-on-hover .mfn-menu-item-has-megamenu.mfn-menu-li').length ) { 5828 headerTemplate.detectHover(); 5829 } 5830 5831 if( $('.mfn-header-tmpl').hasClass('mfn-header-content-blur') || $('.mfn-header-tmpl').hasClass('mfn-header-content-gray') || $('.mfn-header-tmpl').hasClass('mfn-header-content-overlay') ){ 5832 headerTemplate.animContentOnHover(); 5833 } 5834 5835 if( $('.mfn-header-tmpl').hasClass('mfn-hasSticky') ) { 5836 headerTemplate.hasSticky = true; 5837 }else{ 5838 headerTemplate.hasSticky = false; 5839 } 5840 5841 if( $('body style.tmp-mfn-header-template').length ) $('body style.tmp-mfn-header-template').remove(); 5842 5843 if( $('.mfn-header-tmpl .close-closeable-section').length ) headerTemplate.closeable(); 5844 5845 if( $('body').hasClass('mfn-header-scrolled') && !$('.mfn-builder-active').length ) $('body').removeClass('mfn-header-scrolled'); 5846 5847 headerTemplate.getHeight(); 5848 headerTemplate.offset(); 5849 5850 headerTemplate.scroll(); 5851 5852 if( $(window).scrollTop() > 10 ){ 5853 $(window).trigger('scroll'); 5854 } 5855 5856 if( $('#wpadminbar').length ) { 5857 let admin_bar_h = $('#wpadminbar').outerHeight(); 5858 if($('.mfn-header-tmpl.mfn-header-tmpl-fixed').length) $('.mfn-header-tmpl.mfn-header-tmpl-fixed').css({'margin-top': admin_bar_h}); 5859 if($(window).width() < 767 && $('.mfn-header-tmpl.mfn-mobile-header-tmpl-fixed').length) $('.mfn-header-tmpl.mfn-mobile-header-tmpl-fixed').css({'margin-top': admin_bar_h}); 5860 5861 } 5862 5863 }, 5864 scroll: function() { 5865 5866 // relative header prevent skip with sticky 5867 if( $('.mfn-header-tmpl').hasClass('mfn-header-tmpl-default') && headerTemplate.hasSticky && !headerTemplate.isMobile ) { 5868 $('body').append('<style class="tmp-mfn-header-template">html body.mfn-header-scrolled{padding-top: '+headerTemplate.height+'px;}</style>'); 5869 } 5870 5871 // console.log('header scroll / '+headerTemplate.offsetScroll); 5872 5873 $(window).scroll(function() { 5874 var scrolled = $(this).scrollTop(); 5875 var scroll_offset = headerTemplate.offsetScroll; 5876 if( headerTemplate.hasSticky && !headerTemplate.isMobile ) scroll_offset = headerTemplate.height; 5877 5878 if(scrolled > scroll_offset) { 5879 $('body').addClass('mfn-header-scrolled'); 5880 5881 if( ($('.mfn-header-tmpl').hasClass('mfn-header-tmpl-fixed') && !headerTemplate.isMobile) || ( $('.mfn-header-tmpl').hasClass('mfn-mobile-header-tmpl-fixed') && headerTemplate.isMobile) && $('.mfn-header-tmpl .hide-on-scroll:not(.closeable-hidden)').length ){ 5882 if( headerTemplate.hasSticky && !headerTemplate.isMobile ) { 5883 $('.mfn-header-tmpl').css({'top': 0}); 5884 }else{ 5885 $('.mfn-header-tmpl').css({'top': '-'+headerTemplate.offsetScroll+'px'}); 5886 } 5887 } 5888 5889 }else{ 5890 $('body').removeClass('mfn-header-scrolled'); 5891 5892 if( ($('.mfn-header-tmpl').hasClass('mfn-header-tmpl-fixed') && !headerTemplate.isMobile) || ( $('.mfn-header-tmpl').hasClass('mfn-mobile-header-tmpl-fixed') && headerTemplate.isMobile) && $('.mfn-header-tmpl .hide-on-scroll:not(.closeable-hidden)').length ){ 5893 $('.mfn-header-tmpl').css({'top': '-'+scrolled+'px'}); 5894 //$('.mfn-header-tmpl').css({'top': '0px'}); 5895 } 5896 5897 if( $('#wpadminbar').length ) { 5898 let admin_bar_h = $('#wpadminbar').outerHeight(); 5899 if($('.mfn-header-tmpl.mfn-header-tmpl-fixed').length) $('.mfn-header-tmpl.mfn-header-tmpl-fixed').css({'margin-top': admin_bar_h}); 5900 if($(window).width() < 767 && $('.mfn-header-tmpl.mfn-mobile-header-tmpl-fixed').length) $('.mfn-header-tmpl.mfn-mobile-header-tmpl-fixed').css({'margin-top': admin_bar_h}); 5901 5902 } 5903 5904 } 5905 }); 5906 }, 5907 getHeight: function() { 5908 headerTemplate.height = $('.mfn-header-tmpl').outerHeight(); 5909 if( headerTemplate.type != 'default' && headerTemplate.hasBodyOffset ){ 5910 $('#Wrapper').css({ 'padding-top' : headerTemplate.height }); 5911 }else{ 5912 $('#Wrapper').removeAttr('style'); 5913 } 5914 $('.mfn-header-tmpl').removeAttr('style'); 5915 }, 5916 5917 readcookie: function(name){ 5918 var nameEQ=name+"="; 5919 var ca=document.cookie.split(';'); 5920 for(var i=0;i<ca.length;i++){ 5921 var c=ca[i]; 5922 while(c.charAt(0)==' ')c=c.substring(1,c.length); 5923 if(c.indexOf(nameEQ)==0) return c.substring(nameEQ.length,c.length) 5924 } 5925 5926 return null 5927 }, 5928 5929 } 5930 5931 5932let mfnMarqueeText = { 5933 win_width: 1920, 5934 5935 init: function() { 5936 5937 if( !$('.mfn-marquee-text-wrapper').length ) return; 5938 5939 this.win_width = $(window).width(); 5940 5941 setTimeout(function() { 5942 mfnMarqueeText.set(); 5943 }, 100); 5944 5945 }, 5946 5947 set: function() { 5948 $('.mfn-marquee-text-wrapper:not(.initialized)').each(function(i, el) { 5949 5950 if( !$(this).find('.mfn-marquee-text').length ) return; 5951 $(this).addClass('initialized'); 5952 let track = $(this).find('.mfn-marquee-text'); 5953 let width = track.outerWidth(); 5954 5955 document.body.style.display = 'table'; 5956 document.body.offsetHeight; // FIX: mobile safari force reflow 5957 document.body.style.display = ''; 5958 5959 if( width == 0 ) return; 5960 5961 let divi = Math.round( (mfnMarqueeText.win_width / width) ) + 1; 5962 let iter = Math.round(Math.ceil(divi / 2) * 2); 5963 5964 if( iter < 2 ) return; 5965 5966 let track_html = track.html(); 5967 5968 for (var j = 1;
5968 j <= iter; j++) { 5969 track.append(track_html); 5970 } 5971 5972 let count = track.find('.mfn-marquee-item').length; 5973 5974 if( count % 2 !== 0 ){ 5975 track.append(track_html); 5976 } 5977 5978 }); 5979 5980 } 5981 5982} 5983 5984mfnMarqueeText.init(); 5985 5986$(document).on('mfn:ajax:refresh', mfnMarqueeText.init); 5987 5988 5989 5990 /** 5991 * 5992 * Read more 5993 * 5994 * */ 5995 5996 let mfnReadMore = { 5997 5998 init: function() { 5999 6000 if ($('body').hasClass('mfn-ui')) return false; 6001 if (!$('.mfn-read-more').length) return false; 6002 6003 mfnReadMore.prepare(); 6004 mfnReadMore.click(); 6005 }, 6006 6007 prepare: function() { 6008 6009 if ($('body').hasClass('mfn-ui')) return false; 6010 6011 $('.mfn-read-more').each(function() { 6012 let this_wrapper = $(this).closest('.column'); 6013 let copy = this_wrapper.nextAll('.column').addClass('mfn-read-more-hidden'); 6014 6015 if (copy.length) { 6016 $.each(copy, function(i, item) { 6017 this_wrapper.before(item); 6018 }); 6019 } 6020 }); 6021 }, 6022 6023 open: function($wrapper) { 6024 $wrapper.find('.mfn-read-more-hidden').each(function() { 6025 let $el = $(this); 6026 6027 $el 6028 .stop(true, true) 6029 .addClass('showed') 6030 .hide() 6031 .slideDown(500, function() { 6032 $(this).css('display', 'flex'); 6033 }); 6034 }); 6035 }, 6036 6037 close: function($wrapper) { 6038 $wrapper.find('.mfn-read-more-hidden').each(function() { 6039 let $el = $(this); 6040 6041 $el 6042 .stop(true, true) 6043 .css('display', 'flex') 6044 .slideUp(500, function() { 6045 $(this) 6046 .removeClass('showed') 6047 .css('display', ''); 6048 }); 6049 }); 6050 }, 6051 6052 click: function() { 6053 6054 $(document).on('click', '.mfn-read-more', function(e) { 6055 e.preventDefault(); 6056 6057 let box = $(this); 6058 let wrapper = box.closest('.mcb-wrap'); 6059 6060 let label1 = box.attr('data-title1'); 6061 let label2 = box.attr('data-title2'); 6062 6063 let icon1 = box.attr('data-icon1'); 6064 let icon2 = box.attr('data-icon2'); 6065 6066 let label = box.find(box.attr('data-label_path')); 6067 let icon = box.find(box.attr('data-icon_path')); 6068 6069 if (wrapper.hasClass('mfn-read-more-expanded')) { 6070 6071 mfnReadMore.close(wrapper); 6072 wrapper.removeClass('mfn-read-more-expanded'); 6073 label.html(label1); 6074 6075 if (icon1 != '' && icon.length) { 6076 icon.html('<i class="' + icon1 + '"></i>'); 6077 } else { 6078 icon.remove(); 6079 } 6080 6081 } else { 6082 6083 mfnReadMore.open(wrapper); 6084 wrapper.addClass('mfn-read-more-expanded'); 6085 label.html(label2); 6086 6087 if (icon2 != '') { 6088 if (icon.length) { 6089 icon.html('<i class="' + icon2 + '"></i>'); 6090 } else { 6091 if (box.find('.mfn-icon-box').length) { 6092 box.find('.mfn-icon-box').prepend('<span class="' + box.attr('data-icon_path').replace('.', '') + '"><i class="' + icon2 + '"></i></span>'); 6093 } else { 6094 box.prepend('<span class="' + box.attr('data-icon_path').replace('.', '') + '"><i class="' + icon2 + '"></i></span>'); 6095 } 6096 } 6097 } 6098 } 6099 6100 $(window).trigger('resize'); 6101 6102 setTimeout(function() { 6103 $(window).trigger('resize'); 6104 }, 600); 6105 }); 6106 } 6107 6108 }; 6109 6110 6111 /** 6112 * 6113 * Popup template 6114 * 6115 * */ 6116 6117 let mfnPopup = { 6118 6119 init: function() { 6120 6121 // mfnPopup.init() 6122 6123 if( $('body').hasClass('elementor-editor-active') ) return; // stop if elementor builder is active 6124 6125 $(document).on('click', '.open-mfn-popup', function(e) { 6126 e.preventDefault(); 6127 let popup_id = $(this).attr('data-mfnpopup'); 6128 6129 if( popup_id == 'popup_id_required' ){ 6130 alert('Popup ID id required'); 6131 }else if( !$(popup_id).length ){ 6132 alert('We cannot find popup with inserted ID'); 6133 }else{ 6134 mfnPopup.showPopup($(popup_id)); 6135 } 6136 }); 6137 6138 6139 if( !$('body').hasClass('mfn-cookies-open') ) mfnPopup.open(); 6140 6141 $(document).on('click', '.exit-mfn-popup', function(e) { 6142 e.preventDefault(); 6143 let $popup = $(this).closest('.mfn-popup-tmpl'); 6144 mfnPopup.hidePopup($popup); 6145 }); 6146 6147 }, 6148 6149 open: function() { 6150 if( $('.mfn-popup-tmpl.mfn-popup-tmpl-display-on-scroll').length ) mfnPopup.showOnScroll(); 6151 if( $('.mfn-popup-tmpl.mfn-popup-tmpl-display-start-delay').length ) mfnPopup.showOnDelay(); 6152 if( $('.mfn-popup-tmpl.mfn-popup-tmpl-display-on-exit').length ) mfnPopup.showOnExit(); 6153 if( $('.mfn-popup-tmpl.mfn-popup-tmpl-display-scroll-to-element').length ) mfnPopup.showOnScrollToElement(); 6154 if( $('.mfn-popup-tmpl.mfn-popup-tmpl-display-on-start').length ) mfnPopup.showOnStart(); 6155 }, 6156 6157 hidePopup: function( $popup ) { 6158 6159 if( $popup.find('video').length ) $popup.find('video').get(0).pause(); 6160 6161 if( $popup.find('iframe').length ) { 6162 var popup_iframe = $popup.find('iframe')[0]; 6163 var ifr_src = $(popup_iframe).attr('src'); 6164 6165 if( typeof ifr_src != 'undefined' ){ 6166 if( ifr_src.includes('youtu') ) popup_iframe.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*'); // yt 6167 6168 if( ifr_src.includes('vimeo') ) { 6169 $(popup_iframe).attr('src', ifr_src); // vimeo 6170 //popup_iframe.pause(); 6171 } 6172 } 6173 6174 } 6175 6176 $popup.removeClass('mfn-popup-active'); 6177 $('html').removeClass('mfn-popup-browser-scroll-disabled'); 6178 6179 if( $('style.mfn-popup-tmpl-blur-'+$popup.attr('data-id')).length ){ 6180 $('style.mfn-popup-tmpl-blur-'+$popup.attr('data-id')).remove(); 6181 } 6182 6183 if( $popup.hasClass('mfn-popup-tmpl-display-cookie-based') || $popup.hasClass('mfn-popup-tmpl-display-one') ){ 6184 let days = 365; 6185 6186 if( $popup.hasClass('mfn-popup-tmpl-display-cookie-based') ) days = parseInt($popup.attr('data-cookie')); 6187 6188 let cookie_name = 'mfn_popup_'+$popup.attr('data-id'); 6189 mfnPopup.addCookie(days, cookie_name); 6190 } 6191 6192 }, 6193 6194 showPopup: function( $popup ){ 6195 6196 let cookie_name = 'mfn_popup_'+$popup.attr('data-id'); 6197 if( mfnPopup.checkCookie(cookie_name) ) return; 6198 6199 if( typeof $popup.attr('data-blur') !== 'undefined' ){ 6200 $('body').append('<style class="mfn-popup-tmpl-blur-'+$popup.attr('data-id')+'">#Wrapper{ filter: blur('+$popup.attr('data-blur')+'px) }</style>'); 6201 } 6202 6203 if( !$popup.hasClass('mfn-popup-active') ) $popup.addClass('mfn-popup-active mfn-popup-showed'); 6204 6205 if( $popup.hasClass('mfn-popup-tmpl-hide-automatically-delay') ) mfnPopup.hideAutomatically($popup); 6206 if( $popup.hasClass('mfn-popup-tmpl-close-button-show-delay') ) mfnPopup.showExitButton($popup); 6207 6208 if( !$('body').hasClass('mfn-ui') && $popup.hasClass('mfn-popup-close-on-overlay-click') ){ 6209 $popup.bind('click', mfnPopup.closeOverlayClick); 6210 } 6211 6212 if( !$popup.hasClass('mfn-popup-browser-scroll-enabled') ){ 6213 $('html').addClass('mfn-popup-browser-scroll-disabled'); 6214 } 6215 6216 bannerBox.set(); 6217 6218 if( $popup.find('.slick-initialized').length ){ 6219 $popup.find('.slick-initialized').slick('refresh'); 6220 } 6221 6222 $(document).trigger('mfnPopupInit'); 6223 }, 6224 6225 closeOverlayClick: function(e) { 6226 var div = $(e.delegateTarget).find('.mfn-popup-tmpl-content-wrapper'); 6227 if (!div.is(e.target) && div.has(e.target).length === 0){ 6228 mfnPopup.hidePopup($(e.delegateTarget)); 6229 $(e.delegateTarget).unbind('click', mfnPopup.closeOverlayClick); 6230 } 6231 }, 6232 6233 hideAutomatically: function($popup) { 6234 if( $('body').hasClass('mfn-ui') ) return; 6235 let delay = parseInt( $popup.attr('data-hidedelay') ); 6236 setTimeout(function() { mfnPopup.hidePopup($popup); }, delay); 6237 }, 6238 6239 showExitButton: function($popup) { 6240 let delay = parseInt( $popup.attr('data-closebuttondelay') ); 6241 setTimeout(function() { $popup.addClass('mfn-closebutton-active'); }, delay); 6242 }, 6243 6244 showOnScroll: function() { 6245 $('.mfn-popup-tmpl.mfn-popup-tmpl-display-on-scroll').each(function() { 6246 let $popup = $(this); 6247 let scroll_offset = parseInt( $popup.attr('data-display') ); 6248 6249 $(window).on('scroll', function() { 6250 if( $(window).scrollTop() > scroll_offset && !$popup.hasClass('mfn-popup-showed') ) mfnPopup.showPopup($popup); 6251 }); 6252 6253 }); 6254 }, 6255 6256 showOnScrollToElement: function() { 6257 $('body').imagesLoaded(function() { 6258 $('.mfn-popup-tmpl.mfn-popup-tmpl-display-scroll-to-element').each(function() { 6259 let $popup = $(this); 6260 let scroll_offset = $($popup.attr('data-display')).length ? parseInt( $($popup.attr('data-display')).offset().top ) : 100; 6261 6262 $(window).on('scroll', function() { 6263 if( $(window).scrollTop() > scroll_offset && !$popup.hasClass('mfn-popup-showed') ) mfnPopup.showPopup($popup); 6264 }); 6265 6266 }); 6267 }); 6268 }, 6269 6270 showOnDelay: function() { 6271 $('.mfn-popup-tmpl.mfn-popup-tmpl-display-start-delay').each(function() { 6272 let $popup = $(this); 6273 let delay = parseInt( $popup.attr('data-display') ); 6274 6275 setTimeout(function() { 6276 mfnPopup.showPopup($popup) 6277 }, delay); 6278 }); 6279 }, 6280 6281 showOnExit: function() { 6282 $('.mfn-popup-tmpl.mfn-popup-tmpl-display-on-exit').each(function() { 6283 let $popup = $(this); 6284 6285 $(document).on('mouseleave', function() { 6286 mfnPopup.showPopup($popup) 6287 }); 6288 }); 6289 }, 6290 6291 showOnStart: function() { 6292 $('.mfn-popup-tmpl.mfn-popup-tmpl-display-on-start').each(function() { 6293 let $popup = $(this); 6294 mfnPopup.showPopup($popup) 6295 }); 6296 }, 6297 6298 addCookie(days, cookie_name){ 6299 6300 let date=new Date(); 6301 date.setTime(date.getTime()+(parseInt(days)*24*60*60*1000)); 6302 let expires="; expires="+date.toGMTString(); 6303 document.cookie=cookie_name+"=true"+expires+"; path=/"; 6304 6305 }, 6306 6307 checkCookie(cookie_name){ 6308 var nameEQ = cookie_name+"="; 6309 var ca = document.cookie.split(';'); 6310 for(var i=0;i<ca.length;i++){ 6311 var c = ca[i]; 6312 while(c.charAt(0)==' ') c = c.substring(1,c.length); 6313 if( c.indexOf(nameEQ) == 0 ) return c.substring(nameEQ.length,c.length) 6314 } 6315 return null 6316 } 6317 6318 } 6319 6320 $(document).on('mfn:gdpr2:close', function() { 6321 mfnPopup.open(); 6322 }); 6323 6324 /** 6325 * Read more term desc 6326 */ 6327 6328 var mfnReadMoreTermDesc = function($el) { 6329 6330 var $el = $el.closest('.mfn-desc-expandable'); 6331 6332 var start = $el.css('max-height'), 6333 height; 6334 6335 $el.css('max-height','unset'); 6336 6337 height = $el.outerHeight(); 6338 6339 $el.css('max-height',start); 6340 6341 $el.animate({ 6342 'maxHeight': height + 'px' 6343 },500); 6344 6345 $el.find('.read-more').animate({ 6346 'opacity': 0 6347 },500,function(){ 6348 $(this).hide(); 6349 }); 6350 }; 6351 6352 $(document).on('click', '.mfn-desc-expandable .read-more .read-more-button', function(e) { 6353 e.preventDefault(); 6354 mfnReadMoreTermDesc($(this)); 6355 }); 6356 6357 6358 var mfnSideMenu = { 6359 6360 id: '', 6361 wrapper: false, 6362 hash: false, 6363 submenu: false, 6364 backup: {}, 6365 6366 init: function() { 6367 if( $('.mfn-menu-tabs-wrapper').length ) mfnSideMenu.menutabs(); 6368 6369 if( $('.mfn-sidemenu-menu.mfn-menu-submenu-on.mfn-menu-submenu-toggled').length ) mfnSideMenu.toggleSubmenu(); 6370 if( $('.mfn-sidemenu-menu.mfn-menu-submenu-on.mfn-menu-submenu-replace').length ) mfnSideMenu.replaceSubmenu(); 6371 6372 if( $('a.mfn-open-sidebar').length ) { 6373 mfnSideMenu.click(); 6374 mfnSideMenu.closeClick(); 6375 } 6376 6377 $(document).on('click', '.mfn-sidemenu-menu li a', function(e) { 6378 var href = $(this).attr('href'); 6379
6380 if( href == '#' && $(this).siblings('.outer-menu-sub').length ) { 6381 e.preventDefault(); 6382 $(this).siblings('.outer-menu-sub').trigger('click'); 6383 }else if( href.includes('#') ) { 6384 6385 var href_split = href.split('#'); 6386 if( !$('#'+href_split[1]).length ) return; 6387 6388 e.preventDefault(); 6389 $(this).closest('li').addClass('current-menu-item').siblings('li').removeClass('current-menu-item'); 6390 6391 var offset = $('#'+href_split[1]).offset().top; 6392 6393 offset = offset - ( fixStickyHeaderH() + adminBarH() ); 6394 6395 $('body, html').animate({scrollTop: offset}, 500); 6396 6397 mfnSideMenu.id = $(this).closest('.mfn-sidemenu-tmpl').attr('data-id'); 6398 mfnSideMenu.hide(); 6399 } 6400 6401 }); 6402 6403 }, 6404 6405 closeClick: function() { 6406 $(document).on('click', '.mfn-sidemenu-closebutton', function(e) { 6407 e.preventDefault(); 6408 6409 mfnSideMenu.id = $(this).closest('.mfn-sidemenu-tmpl').attr('data-id'); 6410 mfnSideMenu.hide(); 6411 6412 }); 6413 }, 6414 6415 hide: function() { 6416 $('#mfn-sidemenu-tmpl-'+mfnSideMenu.id).removeClass('mfn-sidemenu-active'); 6417 6418 $('html').addClass('mfn-closing-sidemenu-'+mfnSideMenu.id); 6419 6420 $('html').removeClass('mfn-sidemenu-'+mfnSideMenu.id+'-active'); 6421 $('html').removeClass('mfn-sidemenu-move-content-'+$('#mfn-sidemenu-tmpl-'+mfnSideMenu.id).attr('data-align')); 6422 $('html').removeClass('mfn-sidemenu-bodyscroll-'+$('#mfn-sidemenu-tmpl-'+mfnSideMenu.id).attr('data-bodyscroll')); 6423 $('html').removeClass('mfn-sidemenu-entrance-'+$('#mfn-sidemenu-tmpl-'+mfnSideMenu.id).attr('data-entrance')); 6424 6425 setTimeout(function() { 6426 $('html').removeClass('mfn-closing-sidemenu-'+mfnSideMenu.id); 6427 // $(window).trigger('resize'); 6428 redrawAllRevolutionSliders(); 6429 }, 310); 6430 6431 if( !$('body').hasClass('mfn-ui') && $('#mfn-sidemenu-tmpl-'+mfnSideMenu.id).hasClass('mfn-sidemenu-close-on-overlay-click') ) { 6432 $(document).unbind('click', mfnSideMenu.closeOverlayClick); 6433 } 6434 6435 }, 6436 6437 click: function() { 6438 $(document).on('click', 'a.mfn-open-sidebar', function(e) { 6439 e.preventDefault(); 6440 6441 mfnSideMenu.id = String($(this).attr('data-sidemenu')); 6442 6443 if( !$('#mfn-sidemenu-tmpl-'+mfnSideMenu.id).length ) return; 6444 6445 $('#mfn-sidemenu-tmpl-'+mfnSideMenu.id).addClass('mfn-sidemenu-active'); 6446 6447 $('html').addClass('mfn-sidemenu-entrance-'+$('#mfn-sidemenu-tmpl-'+mfnSideMenu.id).attr('data-entrance')); 6448 $('html').addClass('mfn-sidemenu-'+mfnSideMenu.id+'-active'); 6449 6450 if( $('#mfn-sidemenu-tmpl-'+mfnSideMenu.id).attr('data-entrance') == 'move-content' ){ 6451 $('html').addClass('mfn-sidemenu-move-content-'+$('#mfn-sidemenu-tmpl-'+mfnSideMenu.id).attr('data-align')); 6452 } 6453 6454 if( !$('body').hasClass('mfn-ui') && $('#mfn-sidemenu-tmpl-'+mfnSideMenu.id).hasClass('mfn-sidemenu-close-on-overlay-click') ) { 6455 $(document).bind('click', mfnSideMenu.closeOverlayClick); 6456 } 6457 6458 setTimeout(function(){ 6459 $('html').addClass('mfn-sidemenu-bodyscroll-'+$('#mfn-sidemenu-tmpl-'+mfnSideMenu.id).attr('data-bodyscroll')); 6460 },300); 6461 6462 }); 6463 }, 6464 6465 closeOverlayClick: function(e) { 6466 var div = $('.mfn-sidemenu-tmpl'); 6467 if ( !div.is(e.target) && div.has(e.target).length === 0 && !$(e.target).closest('.mfn-menu-wrapper').length ){ 6468 mfnSideMenu.hide(); 6469 } 6470 }, 6471 6472 menutabs: function() { 6473 $(document).on('click', '.mfn-menu-tabs-wrapper ul.mfn-menu-tabs-nav li a', function(e) { 6474 e.preventDefault(); 6475 6476 if( $(this).parent('li').hasClass('active') ){ 6477 return; 6478 }else{ 6479 $(this).closest('.mfn-menu-tabs-wrapper').find('.active').removeClass('active'); 6480 } 6481 6482 let id = $(this).attr('href'); 6483 $(this).parent('li').addClass('active'); 6484 $(this).closest('.mfn-menu-tabs-wrapper').find(id).addClass('active'); 6485 6486 }); 6487 }, 6488 6489 toggleSubmenu: function() { 6490 $(document).on('click', '.mfn-sidemenu-menu.mfn-menu-submenu-on.mfn-menu-submenu-toggled li.menu-item-has-children .outer-menu
6490-sub', function(e) { 6491 e.preventDefault(); 6492 if( !$(this).closest('li').hasClass('current-menu-item') && !$(this).closest('li').hasClass('current-menu-ancestor') ){ 6493 $(this).closest('li').addClass('current-menu-ancestor'); 6494 }else if( $(this).closest('li').hasClass('current-menu-ancestor') ){ 6495 $(this).closest('li').removeClass('current-menu-ancestor'); 6496 }else{ 6497 $(this).closest('li').toggleClass('current-menu-item'); 6498 } 6499 6500 //$(this).closest('li').toggleClass('current-menu-ancestor'); 6501 //if( $(this).closest('ul').closest('li').hasClass('current-menu-ancestor') ) $(this).closest('ul').closest('li').toggleClass('current-menu-ancestor'); 6502 }); 6503 }, 6504 6505 replaceSubmenu: function() { 6506 $(document).on('click', '.mfn-sidemenu-menu.mfn-menu-submenu-on.mfn-menu-submenu-replace li.menu-item-has-children .outer-menu-sub', function(e) { 6507 e.preventDefault(); 6508 6509 mfnSideMenu.wrapper = $(this).closest('.mfn-menu-wrapper'); 6510 mfnSideMenu.hash = mfnSideMenu.wrapper.attr('data-hash'); 6511 mfnSideMenu.submenu = $(this).closest('li').find('ul.sub-menu').first().html(); 6512 6513 if( typeof mfnSideMenu.backup[mfnSideMenu.hash] === 'undefined' ){ 6514 mfnSideMenu.backup[mfnSideMenu.hash] = []; 6515 } 6516 6517 let newest = {}; 6518 newest.label = $(this).closest('li').find('a.mfn-menu-link .menu-label').html(); 6519 newest.ul = mfnSideMenu.wrapper.children('ul').html(); 6520 6521 mfnSideMenu.backup[mfnSideMenu.hash].push(newest); 6522 6523 if( !mfnSideMenu.wrapper.hasClass('mfn-sidemenu-replaced') ) mfnSideMenu.wrapper.addClass('mfn-sidemenu-replaced'); 6524 6525 setTimeout(mfnSideMenu.updateMenu, 10); 6526 6527 //mfnSideMenu.updateMenu(); 6528 6529 }); 6530 6531 mfnSideMenu.breadcrumbsClick(); 6532 }, 6533 6534 updateMenu: function() { 6535 6536 if(mfnSideMenu.wrapper.find('.mfn-sidemenu-back').length) mfnSideMenu.wrapper.find('.mfn-sidemenu-breadcrumbs').remove(); 6537 6538 mfnSideMenu.wrapper 6539 .find('.mfn-sidemenu-menu').html(mfnSideMenu.submenu); 6540 6541 if( mfnSideMenu.backup[mfnSideMenu.hash].length > 0 ) { 6542 mfnSideMenu.wrapper.prepend('<div class="mfn-sidemenu-breadcrumbs"></div>'); 6543 mfnSideMenu.backup[mfnSideMenu.hash].map(function(el, i) { 6544 mfnSideMenu.wrapper.find('.mfn-sidemenu-breadcrumbs').append('<span class="mfn-sidemenu-breadcrumbs-separator"><i class="icon-left-open"></i></span><a data-index="'+i+'" class="mfn-sidemenu-back" href="#">'+el.label+'</a>'); 6545 }); 6546 6547 } 6548 6549 }, 6550 6551 breadcrumbsClick: function() { 6552 6553 $(document).on('click', '.mfn-sidemenu-back', function(e) { 6554 e.preventDefault(); 6555 6556 mfnSideMenu.wrapper = $(this).closest('.mfn-menu-wrapper'); 6557 mfnSideMenu.hash = mfnSideMenu.wrapper.attr('data-hash'); 6558 6559 let index = $(this).attr('data-index'); 6560 6561 let choosed = mfnSideMenu.backup[mfnSideMenu.hash][index]; 6562 6563 mfnSideMenu.submenu = choosed.ul; 6564 6565 mfnSideMenu.backup[mfnSideMenu.hash] = mfnSideMenu.backup[mfnSideMenu.hash].filter((item,i) => { return i < index }); 6566 6567 //mfnSideMenu.updateMenu(); 6568 setTimeout(mfnSideMenu.updateMenu, 10); 6569 }); 6570 } 6571 6572 } 6573 6574 /** 6575 * Lazy Load images 6576 */ 6577 6578 document.addEventListener('DOMContentLoaded', () => { 6579 6580 const images = Array.from(document.querySelectorAll('img.mfn-lazy')); 6581 6582 if ('IntersectionObserver' in window) { 6583 const imageObserver = new IntersectionObserver((entries, observer) => { 6584 entries.forEach(entry => { 6585 if (entry.isIntersecting) { 6586 const image = entry.target; 6587 image.src = image.dataset.src; 6588 imageObserver.unobserve(image); 6589 window.dispatchEvent(new Event('resize')); 6590 } 6591 }); 6592 }); 6593 6594 images.forEach(img => imageObserver.observe(img)); 6595 } 6596 6597 }); 6598 6599})(jQuery); 6600 6601// Safari resize fix 6602(function() { 6603 let lastZoom = 1; 6604 6605 function getZoom() { 6606 return window.outerWidth / window.innerWidth; 6607 } 6608 6609 function checkZoomReset() { 6610 const currentZoom = getZoom(); 6611 if (Math.abs(currentZoom - 1) < 0.02 && lastZoom !== 1) { 6612 window.scrollTo({ left: 0, top: window.scrollY, behavior: 'instant' }); 6613 } 6614 lastZoom = currentZoom; 6615 } 6616 6617 window.addEventListener('resize', checkZoomReset); 6618})(); 6619 6620// Remove Gray Highlight When Tapping Links in Mobile Safari 6621document.addEventListener("touchstart", function(){}, true);
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.