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