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