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