1/* globals jQuery, mfn */ 2/* jshint esversion: 6 */ 3 4(function($) { 5 6 "use strict"; 7 8 var scrollTicker, lightboxAttr, sidebar, 9 rtl = $('body').hasClass('rtl'), 10 simple = $('body').hasClass('style-simple'), 11 topBarTop = '61px', 12 headerH = 0, 13 screen = 'desktop', 14 mobileInitW = mfn.mobileInit ? mfn.mobileInit : 1240; 15 16 /** 17 * Lightbox | Magnific Popup 18 */ 19 20 if ( ! mfn.lightbox.disable ) { 21 if ( ! ( mfn.lightbox.disableMobile && ( window.innerWidth < 768 ) ) ) { 22 lightboxAttr = { 23 title: mfn.lightbox.title ? mfn.lightbox.title : false, 24 }; 25 } 26 } 27 28 /** 29 * Admin Bar & WooCommerce Store Notice 30 */ 31 32 function adminBarH() { 33 34 var height = 0; 35 36 // WP adminbar 37 38 if ($('body').hasClass('admin-bar')) { 39 var actionBarH = $('#wpadminbar').innerHeight() || 0; 40 height += actionBarH; 41 } 42 43 // WC demo store 44 45 if ($('body').hasClass('woocommerce-demo-store')) { 46 var demoStoreH = $('body > p.demo_store').innerHeight() || 0; 47 height += demoStoreH; 48 } 49 50 return height; 51 } 52 53 /** 54 * Header | Sticky 55 */ 56 57 function mfnSticky() { 58 59 if( ! $('body').hasClass('sticky-header') ){ 60 return false; 61 } 62 63 if( $('body').hasClass('header-creative') && window.innerWidth >= 768 ){ 64 return false; 65 } 66 67 var startY = headerH; 68 var windowY = $(window).scrollTop(); 69 var topBarH = $('#Top_bar').height() || 0; 70 71 if ( windowY > startY ) { 72 73 if ( ! ( $('#Top_bar').hasClass('is-sticky') ) ) { 74 75 $('.header_placeholder').css('height', topBarH); 76 77 $('#Top_bar') 78 .addClass('is-sticky') 79 .css('top', -60) 80 .animate({ 81 'top': adminBarH() + 'px' 82 }, 300); 83 84 headerWidth(); 85 86 $(document).trigger('mfn:header:sticky:on'); 87 } 88 89 } else { 90 91 if ($('#Top_bar').hasClass('is-sticky')) { 92 93 $('.header_placeholder').css('height', 0); 94 $('#Top_bar') 95 .removeClass('is-sticky') 96 .css('top', topBarTop); 97 98 stickyLogo(); 99 headerWidth(); 100 101 $(document).trigger('mfn:header:sticky:off'); 102 103 } 104 105 } 106 107 } 108 109 /** 110 * Header | Sticky | Retina Logo - max height 111 */ 112 113 function stickyLogo() { 114 115 // ! retina display 116 117 if( window.devicePixelRatio <= 1 ){ 118 return false; 119 } 120 121 var parent = $('#Top_bar #logo'), 122 el = $('img.logo-main', parent), 123 height = el.data('height'); 124 125 // ! retina logo set 126 if ( ! parent.hasClass('retina')) { 127 return false; 128 } 129 130 if ( $('body').hasClass('logo-overflow') ) { 131 // do nothing 132 } else if ( height > parent.data('height') ) { 133 height = parent.data('height'); 134 } 135 136 el.css('max-height', height + 'px'); 137 138 } 139 140 /** 141 * Header | Sticky | Height 142 */ 143 144 function mfnStickyH() { 145 146 var topBarH = $('#Top_bar').innerHeight() || 0; 147 148 if ( $('body').hasClass('header-below') ) { 149 150 // header below slider 151 152 var sliderH = $('.mfn-main-slider').innerHeight() || 0; 153 154 headerH = topBarH + sliderH; 155 156 } else { 157 158 // default 159 160 var actionBarH = $('#Action_bar').innerHeight() || 0; 161 162 headerH = topBarH + actionBarH; 163 164 } 165 166 } 167 168 /** 169 * Header | Sticky | Mobile 170 */ 171 172 function mfnMobileSticky() { 173 174 if( ! $('body').hasClass('.mobile-sticky') ){ 175 return false; 176 } 177 178 if( $(window).width() >= 768 ){ 179 return false; 180 } 181 182 var menuH, 183 windowH = $(window).height() || 0, 184 logoH = $('#Top_bar .logo').height() || 0, 185 offset = adminBarH() + logoH; 186 187 if ( ( ! $('#Top_bar').hasClass('is-sticky')) && $('#Action_bar').is(':visible') ) { 188 offset += $('#Action_bar').height() || 0; 189 } 190 191 menuH = windowH - offset; 192 193 if (menuH < 176) { 194 menuH = 176; 195 } 196 197 $('#Top_bar #menu').css('max-height', menuH + 'px'); 198 199 } 200 201 /** 202 * Header | Top bar left | Width 203 */ 204 205 function headerWidth() { 206 207 var rightW = $('.top_bar_right').outerWidth() || 0; 208 209 rightW = Math.ceil( rightW ); 210 211 if( $('body').hasClass('header-modern') ){ 212 rightW += 10; 213 } 214 215 var parentW = $('#Top_bar .one').width() || 0; 216 var leftW = parentW - rightW; 217 218 } 219 220 /** 221 * FIX | Header | Sticky | Height 222 */ 223 224 function fixStickyHeaderH() { 225 226 var stickyH = 0; 227 228 // FIX | sticky top bar height 229 230 var topBar = $('.sticky-header #Top_bar'); 231 232 if( topBar.length ){ 233 234 // default headers 235 236 if (topBar.hasClass('is-sticky')) { 237 stickyH = $('.sticky-header #Top_bar').innerHeight() || 0; 238 } else { 239 topBar.addClass('is-sticky'); 240 stickyH = $('.sticky-header #Top_bar').innerHeight() || 0; 241 topBar.removeClass('is-sticky'); 242 } 243 244 } else if( $('.mfn-header-tmpl-builder').length ) { 245 246 // header template 247 248 var height = $('#mfn-header-template').outerHeight() || 0, 249 shift = parseFloat($('#mfn-header-template').css('top')) || 0; 250 251 stickyH = height + shift; 252 253 } 254 255 // FIX | responsive 256 257 if ( $(window).width() < mobileInitW ) { 258 259 if ( $(window).width() < 768 ) { 260 261 // mobile 262 if (!$('body').hasClass('mobile-sticky')) { 263 stickyH = 0; 264 } 265 266 } else { 267 268 // tablet 269 if (!$('body').hasClass('tablet-sticky')) { 270 stickyH = 0; 271 } 272 273 } 274 275 } else { 276 277 // desktop 278 279 // FIX | header creative 280 if ($('body').hasClass('header-creative')) { 281 stickyH = 0; 282 } 283 284 } 285 286 return stickyH; 287 } 288 289 /** 290 * Sidebar | Height 291 */ 292 293 function mfnSidebar() { 294 if ($('.mcb-sidebar').length) { 295 296 var maxH = $('#Content .sections_group').outerHeight(); 297 298 $('.mcb-sidebar').each(function() { 299 $(this).css('min-height', 0); 300 if ($(this).height() > maxH) { 301 maxH = $(this).height(); 302 } 303 }); 304 305 $('.mcb-sidebar').css('min-height', maxH + 'px'); 306 307 if( sidebar ){ 308 sidebar.stickySidebar('updateSticky'); 309 } 310 311 } 312 } 313 314 315 /** 316 * Into | Full Screen 317 */ 318 319 function mfnIntroH() { 320 321 var windowH = $(window).height() || 0; 322 var headerWrapperH = $('#Header_wrapper').height() || 0; 323 324 windowH = windowH - headerWrapperH - adminBarH(); 325 326 $('#Intro.full-screen').each(function() { 327 328 var el = $(this), 329 inner = $('.intro-inner', el), 330 innerH = inner.height() || 0; 331 332 el.css('padding', 0).css('min-height', windowH); 333 334 var padding = ( windowH - innerH ) / 2; 335 inner.css('padding-top', padding).css('padding-bottom', padding); 336 337 }); 338 } 339 340 /** 341 * Footer | Sliding | Height 342 */ 343 344 function mfnFooter() { 345 346 var footerH = $('#Footer').height() || 0; 347 348 // Fixed, Sliding 349 350 if ($('.footer-fixed #Footer, .footer-sliding #Footer').length) { 351 352 footerH = footerH - 1; 353 $('#Content').css('margin-bottom', footerH + 'px'); 354 355 } 356 357 // Stick to bottom 358 359 if ($('.footer-stick #Footer').length) { 360 361 var headerWrapperH = $('#Header_wrapper').height() || 0; 362 363 var headerFooterH = headerWrapperH + footerH; 364 365 var documentH = $(document).height() - adminBarH(); 366 367 if ( ( documentH <= $(window).height() ) && ( headerFooterH <= $(window).height() ) ) { 368 $('#Footer').addClass('is-sticky'); 369 } else { 370 $('#Footer').removeClass('is-sticky'); 371 } 372 373 } 374 375 } 376 377 /** 378 * Back To Top | Sticky / Show on scroll 379 */ 380 381 function backToTopSticky() { 382 383 if ($('#back_to_top.sticky.scroll').length) { 384 var el = $('#back_to_top.sticky.scroll'); 385 386 // Clear Timeout if one is pending 387 if (scrollTicker) { 388 window.clearTimeout(scrollTicker); 389 scrollTicker = null; 390 } 391 392 el.addClass('focus'); 393 394 // Set Timeout 395 scrollTicker = window.setTimeout(function() { 396 el.removeClass('focus'); 397 }, 1500); // Timeout in msec 398 399 } 400 401 } 402 403 /** 404 * # Hash smooth navigation 405 */ 406 407 function hashNav() { 408 409 var hash = window.location.hash; 410 411 if (hash) { 412 413 // FIX | Master Slider 414 415 if (hash.indexOf("&") > -1 || hash.indexOf("/") > -1) { 416 return false;
417 } 418 419 // Contact Form 7 in popup 420 421 if (hash.indexOf("wpcf7") > -1) { 422 cf7popup(hash); 423 } 424 425 if ($(hash).length) { 426 427 var offset = 0, 428 headerH = fixStickyHeaderH(), 429 tabH = $(hash).siblings('.ui-tabs-nav').innerHeight() || 0; 430 431 // header builder 432 433 if( $('body').hasClass('mhb') ){ 434 435 var currentView = $('.mhb-view').filter(':visible'); 436 headerH = currentView.height() || 0; 437 438 } 439 440 offset = headerH + adminBarH() + tabH; 441 442 $('html, body').animate({ 443 scrollTop: $(hash).offset().top - offset 444 }, 500); 445 } 446 447 } 448 449 } 450 451 /** 452 * One Page | Scroll Active 453 */ 454 455 function onePageActive() { 456 if ($('body').hasClass('one-page')) { 457 458 var stickyH = $('.sticky-header #Top_bar').innerHeight() || 0; 459 if( $('#mfn-header-template').length ) stickyH = $('#mfn-header-template').innerHeight() || 0; 460 var windowT = $(window).scrollTop(); 461 var start = windowT + stickyH + adminBarH() + 1; 462 var first = false; 463 464 $('[data-id]:not(.elementor-element), section[data-id]').each(function() { 465 466 // FIX | elementor adds own data-id for each section 467 468 if( $(this).attr('data-id') && ( -1 == $(this).attr('data-id').indexOf('#') ) ){ 469 return true; 470 } 471 472 if ($(this).visible(true)) { 473 474 if (!first) { 475 first = $(this); 476 } else if (($(this).offset().top < start) && ($(this).offset().top > first.offset().top)) { 477 first = $(this); 478 } 479 } 480 481 if (first) { 482 483 var newActive = first.attr('data-id'); 484 var active = '[data-hash="' + newActive + '"]'; 485 486 if (newActive) { 487 var menu = $('#menu, .mhb-menu'); 488 if( $('#mfn-header-template').length ) menu = $('#mfn-header-template .mfn-header-menu.mfn-header-mainmenu'); 489 menu.find('li').removeClass('current-menu-item current-menu-parent current-menu-ancestor current_page_item current_page_parent current_page_ancestor'); 490 $(active, menu) 491 .closest('li').addClass('current-menu-item') 492 .closest('.menu > li').addClass('current-menu-item'); 493 } 494 495 } 496 497 }); 498 499 } 500 } 501 502 /** 503 * Contact Form 7 | Popup 504 */ 505 506 function cf7popup(hash) { 507 if (hash && $(hash).length) { 508 var id = $(hash).closest('.popup-content').attr('id'); 509 510 $('a.popup-link[href="#' + id + '"]:not(.once)') 511 .addClass('once') 512 .trigger('click'); 513 514 } 515 } 516 517 /** 518 * Sticky | Wrap 519 */ 520 521 var stickyWrap = { 522 523 headerH: 0, 524 525 // stickyWrap.init() 526 527 init: function(){ 528 529 // calculate 530 531 stickyWrap.headerH = fixStickyHeaderH() + adminBarH(); 532 533 // prepare dom 534 535 $('.mcb-wrap.sticky.sticky-'+screen+':not(.stickied)').each(function(){ 536 537 var $wrap = $(this); 538 539 if( screen == 'desktop' && $wrap.hasClass('one') ) return; 540 if( screen == 'tablet' && $wrap.hasClass('tablet-one') ) return; 541 if( screen == 'mobile' && $wrap.hasClass('mobile-one') ) return; 542 543 var size = $wrap.attr('data-'+screen+'-col'), 544 padding = { 545 top : $wrap.css('padding-top'), 546 right : $wrap.css('padding-right'), 547 bottom : $wrap.css('padding-bottom'), 548 left : $wrap.css('padding-left'), 549 }; 550 551 padding = Object.values(padding).join(' '); 552 553 $wrap.css('padding', padding); 554 555 $wrap.addClass('stickied').removeClass(size).addClass('one') 556 .wrap(function() { 557 return '<div class="mcb-wrap wrap-sticky-spacer ' + size + '"><div class="mcb-wrap wrap-sticky-rails"></div></div>'; 558 }); 559 560 }); 561 562 // initial scroll 563 564 stickyWrap.scroll(); 565 566 }, 567 568 // stickyWrap.scroll() 569 570 scroll: function(){ 571 572 if( ! $('.mcb-wrap.sticky.sticky-'+screen).length ){ 573 return; 574 } 575 576 var windowY = $(window).scrollTop(); 577 578 $('.mcb-wrap.sticky.sticky-'+screen+'.stickied').each(function(){ 579 580 var $wrap = $(this), 581 $rails = $wrap.closest('.wrap-sticky-rails'), 582 $section = $wrap.closest('.mcb-section-inner'); 583 584 var width = $rails.width() || 0, 585 sectionT = $section.offset().top, 586 sectionH = $section.innerHeight(), 587 wrapH = $wrap.outerHeight(); 588 589 var start = windowY + stickyWrap.headerH - sectionT, 590 limit = start + wrapH - sectionH; 591 592 $wrap.css( 'width', width ) 593 .closest('.wrap-sticky-rails').css('min-height', sectionH + 'px'); 594 595 if( limit > 0 ){ 596 597 $wrap.removeClass('fixed').addClass('stick-bottom').css({ 598 'top' : '' 599 }); 600 601 } else { 602 603 $wrap.removeClass( 'stick-bottom' ); 604 605 if( start > 0 ){ 606 $wrap.addClass('fixed').css({ 607 'top' : stickyWrap.headerH + 'px' 608 }); 609 } else { 610 $wrap.removeClass('fixed').css({ 611 'top' : '' 612 }); 613 } 614 615 } 616 617 }); 618 619 }, 620 621 reset: function() { 622 // stickyWrap.reset() 623 624 if( $('.wrap-sticky-spacer').length ){ 625 $('.wrap-sticky-spacer').each(function() { 626 $(this).find('.mcb-wrap.sticky').removeClass('stickied one fixed').addClass( $(this).find('.mcb-wrap.sticky').attr('data-'+screen+'-col') ).css({'top': '0', 'width': ''}); 627 $(this).replaceWith( $(this).find('.mcb-wrap.sticky') ); 628 }); 629 } 630 631 if( $('.mcb-wrap.sticky.sticky-'+screen+':not(.stickied)').length ){ 632 stickyWrap.init(); 633 } 634 635 } 636 637 }; 638 639 /** 640 * $(document).ready 641 * Specify a function to execute when the DOM is fully loaded. 642 */ 643 644 $(document).ready(function() { 645 646 /** 647 * Isotope 648 */ 649 650 class Isotope { 651 constructor(){ 652 this.runIsotopes = this.runIsotopes.bind(this); 653 this.itemToModify = {}; 654 this.ajaxObjects = []; 655 } 656 657 get getList() { 658 return [ 659 { 660 name: 'Portfolio - Isotope', 661 location: '.blog_wrapper .isotope:not( .masonry ), .portfolio_wrapper .isotope:not( .masonry-flat, .masonry-hover, .masonry-minimal )', 662 beforeActive: () => null, 663 afterActive: () => null, 664 settings: { 665 itemSelector: '.isotope-item', 666 layoutMode: 'fitRows', 667 isOriginLeft: rtl ? false : true 668 } 669 }, 670 { 671 name: 'Portfolio - Masonry Flat', 672 location: '.portfolio_wrapper .masonry-flat', 673 beforeActive: () => null, 674 afterActive: () => null, 675 settings: { 676 itemSelector: '.isotope-item', 677 percentPosition: true, 678 masonry: { columnWidth: 1 }, 679 isOriginLeft: rtl ? false : true 680 } 681 }, 682 { 683 name: 'Blog & Portfolio & Shop - Masonry', 684 location: '.isotope.masonry, .isotope.masonry-hover, .isotope.masonry-minimal', 685 beforeActive: () => null, 686 afterActive: () => null, 687 settings: { 688 itemSelector: '.isotope-item', 689 layoutMode: 'masonry', 690 isOriginLeft: rtl ? false : true 691 } 692 }, 693 /*{ 694 name: 'General - Masonry Isotope', 695 location: '.masonry.isotope, .masonry.gallery', 696 beforeActive: () => null, 697 afterActive: () => null, 698 settings: {} 699 }, 700 { 701 name: 'General - Isotope', 702 location: '.isotope', 703 beforeActive: () => null, 704 afterActive: () => null, 705 settings: {}, 706 },*/ 707 { 708 name: 'Filters - Isotope Event on Click', 709 location: '.isotope-filters .filters_wrapper', 710 beforeActive: () => null, 711 afterActive: ({location}) => { 712 const filterButtons = $(location).find('li:not(.close) a'); 713 filterButtons.on('click', (e) => { 714 e.preventDefault(); 715 const buttonClicked = $(e.target); 716
717 let isoWrapper = $('.isotope'), 718 filters = buttonClicked.closest('.isotope-filters'), 719 parent = filters.attr('data-parent'); 720 721 if (parent) { 722 parent = filters.closest('.' + parent); 723 isoWrapper = parent.find('.isotope').first(); 724 } 725 726 filters.find('li').removeClass('current-cat'); 727 buttonClicked.closest('li').addClass('current-cat'); 728 729 $('.isotope-filters .filters_wrapper').find('li').removeClass('current-cat'); 730 this.isotopeFilter(buttonClicked, isoWrapper); 731 }) 732 }, 733 settings: 'do-not-run' 734 }, 735 ...this.ajaxObjects //dynamical loaded content, like load more. 736 ] 737 } 738 739 // One liners, queries to isotope API 740 addEventListener(onEvent, doWhat) { 741 return $(document).on( `isotope:${onEvent}`, doWhat) 742 } 743 queryIsotopeAPI(location, apiAction, actionToPass) { 744 return $(location).isotope(apiAction, actionToPass); 745 }; 746 triggerIsotopeEvent(doWhat) { 747 return $(document).trigger(`isotope:${doWhat}`) 748 } 749 750 // Add elements which require isotope and are loaded on the fly 751 addIsotopeLocation( payload ) { 752 if ( !payload.location ) return console.error('MfnIsotope Error: No Location Provided!'); 753 754 // Push it to object 755 this.ajaxObjects.push( 756 { 757 name: payload.name ? payload.name : 'No name applied - Dynamic Isotope Function', 758 location: payload.location, 759 beforeActive: payload.beforeActive ? payload.beforeActive : () => null, 760 afterActive: payload.afterActive ? payload.afterActive : () => null, 761 settings: payload.settings ? payload.settings : '' 762 } 763 ); 764 765 // Reload it anyway while using that option 766 $( payload.location ).isotope( payload.settings ) 767 } 768 769 isotopeFilter( domEl, isoWrapper ) { 770 if( !domEl || !isoWrapper ) return console.error('MfnIsotope Error: isotopeFilter, missing one of the values!'); 771 const filter = domEl.attr('data-rel'); 772 773 isoWrapper.isotope({ filter }); 774 775 queueMicrotask(() => $(window).trigger('resize')); 776 777 setTimeout(function() { 778 mfnIsotope.triggerIsotopeEvent('arrange'); 779 }, 500); 780 } 781 782 // Usually for init, turn on all of the isotopes! 783 runIsotopes( resize = true ) { 784 const isotopeList = this.getList; 785 786 //console.log(isotopeList); 787 788 isotopeList.map(item => { 789 //console.log(jQuery(item.location)); 790 if( $(item.location).length ) { 791 // HOOK, before isotope binding 792 item.beforeActive(item) 793
794 // Trigger resize to recalculate some plugins stuff 795 if( resize ){ 796 $(window).trigger('resize'); 797 } 798 799 // Isotope init 800 if( 'do-not-run' !== item.settings ){ 801 queueMicrotask(() => $( item.location ).isotope( item.settings )); 802 } 803 804 // HOOK, after isotope binding 805 item.afterActive(item); 806 } 807 }); 808 } 809 } 810 811 const mfnIsotope = new Isotope; 812 mfnIsotope.runIsotopes(); 813 814 /** 815 * Waypoints 816 */ 817 818 class Waypoints { 819 constructor(){ 820 this.runWaypoints = this.runWaypoints.bind(this); 821 } 822 823 get getList() { 824 return [ 825 { 826 name: 'Chart', 827 location: '.sections_group .chart, .elementor-section .chart', 828 beforeActive: () => {}, 829 afterActive: () => {}, 830 settings: () => { 831 return { 832 offset: '100%', 833 triggerOnce: true, 834 handler: function(){ 835 var el = $(this.element).length ? $(this.element) : $(this); 836 var lineW = simple ? 4 : 8; 837 838 el.easyPieChart({ 839 animate: 1000, 840 lineCap: 'circle', 841 lineWidth: lineW, 842 size: 140, 843 scaleColor: false 844 }); 845 846 if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { 847 this.destroy(); 848 } 849 } 850 } 851 } 852 }, 853 { 854 name: 'Progress Icons', 855 location: '.progress_icons', 856 beforeActive: () => {}, 857 afterActive: () => {}, 858 settings: () => { 859 return { 860 offset: '100%', 861 triggerOnce: true, 862 handler: function() { 863 var el = $(this.element).length ? $(this.element) : $(this); 864 var active = el.attr('data-active'); 865 var color = el.attr('data-color'); 866 var transparent = el.hasClass('transparent'); 867 var icon = el.find('.progress_icon'); 868 var timeout = 200; // timeout in milliseconds 869 870 icon.each(function(i) { 871 if (i < active) { 872 var time = (i + 1) * timeout; 873 setTimeout(function() { 874 875 $(icon[i]).addClass('themebg'); 876 877 if( transparent ){ 878 $(icon[i]).css('color', color); 879 } else { 880 $(icon[i]).css('background-color', color); 881 } 882 883 }, time); 884 } 885 }); 886 887 if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { 888 this.destroy(); 889 } 890 } 891 } 892 } 893 }, 894 { 895 name: 'Animate Math | Counter, Quick Fact, etc.', 896 location: '.animate-math .number', 897 beforeActive: () => {}, 898 afterActive: () => {}, 899 settings: () => { 900 return { 901 offset: '100%', 902 triggerOnce: true, 903 handler: function() { 904 var el = $(this.element).length ? $(this.element) : $(this); 905 var duration = Math.floor((Math.random() * 1000) + 1000); 906 var to = el.attr('data-to'); 907 908 $({ 909 property: 0 910 }).animate({ 911 property: to 912 }, { 913 duration: duration, 914 easing: 'linear', 915 step: function() { 916 el.text(Math.floor(this.property)); 917 }, 918 complete: function() { 919 el.text(this.property); 920 } 921 }); 922 923 if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { 924 this.destroy(); 925 } 926 } 927 } 928 } 929 }, 930 { 931 name: 'Infinite Scroll | Blog & Portfolio', 932 location: '.mfn-infinite-load-button', 933 infiniteLoadButton: $('.mfn-infinite-load-button a'), 934 beforeActive: () => {}, 935 afterActive: ({infiniteLoadButton}) => { 936 // Leave it, probably will be necessary soon. 937 // const itemProvided = $('.column_portfolio').length ? '.column_portfolio' : '.column_blog'; 938 939 // $(`html, ${itemProvided}`).waypoint({ 940 // handler: function(direction) { 941 // infiniteScrollFunction($(location), infiniteLoadButton, direction); 942 // }, 943 // offset: 'bottom-in-view' 944 // }); 945 },
946 settings: ({infiniteLoadButton, location}) => { 947 return { 948 handler: function(direction) { 949 infiniteScrollFunction($(location), infiniteLoadButton, direction); 950 }, 951 offset: function(){ 952 //after each load, calc the offset of element to know when posts should be loaded 953 var offsetPosition = - ( ($(this)[0].element.scrollHeight) - (window.innerHeight / 1.2) ); 954 return offsetPosition; 955 } 956 } 957 } 958 }, 959 { 960 name: 'Bars List', 961 location: '.bars_list', 962 beforeActive: () => {}, 963 afterActive: ({infiniteLoadButton}) => {}, 964 settings: () => { 965 return { 966 offset: '100%', 967 triggerOnce: true, 968 handler: function() { 969 970 var el = $(this.element).length ? $(this.element) : $(this); 971 972 el.addClass('hover'); 973 974 if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { 975 this.destroy(); 976 } 977 } 978 } 979 } 980 } 981 ] 982 } 983 984 985 runWaypoints(){ 986 const waypoints = this.getList; 987 988 waypoints.map(item => { 989 if( $(item.location).length ) { 990 // HOOK, before waypoints binding 991 item.beforeActive(item) 992 993 // waypoints init 994 queueMicrotask(() => $(item.location).waypoint(item.settings( item )) ); 995 996 // HOOK, after waypoints binding 997 item.afterActive(item); 998 } 999 }) 1000 } 1001 } 1002 1003 const mfnWaypoints = new Waypoints; 1004 mfnWaypoints.runWaypoints(); 1005 1006 /** 1007 * Header template 1008 */ 1009 1010 if( $('.promo_bar_slider').length ){ 1011 promoBarSlider(); 1012 } 1013 1014 headerTemplate.init(); 1015 footerTemplate.init(); 1016 1017 if( $('.mfn-menu-item-megamenu').length ){ 1018 headerMegamenu.init(); 1019 } 1020 1021 $('#Top_bar').removeClass('loading'); 1022 1023 topBarTop = parseInt($('#Top_bar').css('top'), 10); 1024 if (topBarTop < 0) topBarTop = 61; 1025 topBarTop = topBarTop + 'px'; 1026 1027 /** 1028 * Sticky | Sidebar 1029 */ 1030 1031 function sidebarSticky(){ 1032 1033 var spacing = fixStickyHeaderH(); 1034 1035 if( ! mfn.sidebarSticky ){ 1036 return false; 1037 } 1038 1039 sidebar = $('.mcb-sidebar .widget-area').stickySidebar({ 1040 topSpacing: spacing 1041 }); 1042 1043 } 1044 1045 sidebarSticky(); 1046 1047 if( $('.mfn-off-canvas-sidebar').length ){ 1048 offCanvasSidebar.init(); 1049 } 1050 1051 1052 if( $(window).width() < 767 && !$('.mfn-off-canvas-sidebar').length ){ 1053 offCanvasSidebar.mobile(); 1054 screen = 'mobile'; 1055 }else if($(window).width() < 959){ 1056 screen = 'tablet'; 1057 } 1058 1059 $(window).on('debouncedresize', function() { 1060 1061 if( $(window).width() < 767 ){ 1062 screen = 'mobile'; 1063 }else if($(window).width() < 959){ 1064 screen = 'tablet'; 1065 }else if($(window).width() > 960){ 1066 screen = 'desktop'; 1067 } 1068 1069 headerTemplate.init(); 1070 footerTemplate.init(); 1071 1072 // stickyWrap.reset(); 1073 1074 if( $(window).width() < 767 && !$('.mfn-off-canvas-sidebar').length ){ 1075 offCanvasSidebar.mobile(); 1076 }else{ 1077 $('html').removeClass('mfn-ofcs-opened'); 1078 } 1079 1080 }); 1081 1082 /** 1083 * Menu | Overlay 1084 */ 1085 1086 $('.overlay-menu-toggle').on('click',function(e) { 1087 e.preventDefault(); 1088 1089 $(this).toggleClass('focus'); 1090 $('#Overlay').stop(true, true).fadeToggle(500); 1091 1092 var menuH = $('#Overlay nav').height() || 0; 1093 menuH = menuH / 2; 1094 1095 $('#Overlay nav').css('margin-top', '-' + menuH + 'px'); 1096 }); 1097 1098 $('#Overlay').on('click', '.menu-item > a', function() { 1099 $('.overlay-menu-toggle').trigger('click'); 1100 }); 1101 1102 $( '.header-overlay' ).on( 'keydown', function(event) { 1103 if ( 27 == event.keyCode ) { 1104 $('.overlay-menu-toggle.focus').trigger('click'); 1105 } 1106 }); 1107 1108 /** 1109 * Menu | Responsive | button 1110 */ 1111 1112 $('.responsive-menu-toggle').on('click', function(e) { 1113 e.preventDefault(); 1114 1115 var el = $(this); 1116 var menu = $('#Top_bar #menu'); 1117 var menuWrap = menu.closest('.top_bar_left'); 1118 1119 el.toggleClass('active'); 1120 1121 // sticky menu button 1122 if (el.hasClass('is-sticky') && el.hasClass('active') && (window.innerWidth < 768)) { 1123 1124 var top = 0; 1125 if (menuWrap.length) { 1126 top = menuWrap.offset().top - adminBarH(); 1127 } 1128 $('body,html').animate({ 1129 scrollTop: top 1130 }, 200); 1131 1132 } 1133 1134 menu.stop(true, true).slideToggle(200); 1135 }); 1136 1137 // close menu after link click 1138 1139 $('#Top_bar #menu').on('click', 'a:not(.menu-toggle)', function(){ 1140 var $menuButton = $('.responsive-menu-toggle.active'); 1141 1142 if( $menuButton.length ){ 1143 setTimeout(function(){ 1144 $menuButton.trigger('click'); 1145 },300); 1146 } 1147 1148 }); 1149 1150 1151 /** 1152 * Menu | Responsive | Side Slide 1153 */ 1154 1155 function sideSlide() { 1156 1157 //if( $('body').hasClass('mfn-header-template') ) return; 1158 1159 var slide = $('#Side_slide');
1160 var overlay = $('#body_overlay'); 1161 var ssMobileInitW = mobileInitW; 1162 var pos = 'right'; 1163 1164 var shiftSlide = -slide.data('width'); 1165 var shiftBody = shiftSlide / 2; 1166 1167 // constructor 1168 1169 var constructor = function() { 1170 if (!slide.hasClass('enabled')) { 1171 1172 $('nav#menu').detach().appendTo('#Side_slide .menu_wrapper'); 1173 slide.addClass('enabled'); 1174 1175 } 1176 }; 1177 1178 // destructor 1179 1180 var destructor = function() { 1181 if (slide.hasClass('enabled')) { 1182 1183 close(); 1184 $('nav#menu').detach().prependTo('#Top_bar .menu_wrapper'); 1185 slide.removeClass('enabled'); 1186 1187 } 1188 }; 1189 1190 // reload 1191 1192 var reload = function() { 1193 1194 if ( window.innerWidth < ssMobileInitW ) { 1195 constructor(); 1196 } else if( $('body').hasClass('header-shop') ) { 1197 if ($('#Top_bar').hasClass('is-sticky')) { 1198 $(document).trigger('mfn:header:sticky:on'); 1199 } else { 1200 $(document).trigger('mfn:header:sticky:off'); 1201 } 1202 } else { 1203 destructor(); 1204 } 1205 1206 }; 1207 1208 // init 1209 1210 var init = function() { 1211 1212 if (slide.hasClass('left')) { 1213 pos = 'left'; 1214 } 1215 1216 // responsive off 1217 if ($('body').hasClass('responsive-off')) { 1218 ssMobileInitW = 0; 1219 } 1220 1221 // header simple 1222 if ($('body').hasClass('header-simple')) { 1223 ssMobileInitW = 9999; 1224 } 1225 1226 // header style: shop | top bar is sticky 1227 if ($('#Top_bar').hasClass('is-sticky')) { 1228 $(document).trigger('mfn:header:sticky:on'); 1229 } 1230 1231 reload(); 1232 }; 1233 1234 // reset to default 1235 1236 var reset = function(time) { 1237 1238 $('.lang-active.active', slide).removeClass('active').children('i').attr('class', 'icon-down-open-mini'); 1239 $('.lang-wrapper', slide).fadeOut(0); 1240 1241 $('.icon.search.active', slide).removeClass('active'); 1242 $('.search-wrapper', slide).fadeOut(0); 1243 1244 $('.menu_wrapper, .social', slide).fadeIn(time); 1245 1246 }; 1247 1248 // menu button 1249 1250 var button = function() { 1251 1252 // show 1253 1254 if (pos == 'left') { 1255 slide.animate({ 1256 'left': 0 1257 }, 300); 1258 $('body').animate({ 1259 'right': shiftBody 1260 }, 300); 1261 } else { 1262 slide.animate({ 1263 'right': 0 1264 }, 300); 1265 $('body').animate({ 1266 'left': shiftBody 1267 }, 300); 1268 } 1269 1270 overlay.fadeIn(300); 1271 1272 $('body').addClass('side-slide-is-open'); 1273 1274 // reset 1275 1276 reset(0); 1277 1278 }; 1279 1280 // close 1281 1282 var close = function() { 1283 1284 if (pos == 'left') { 1285 slide.animate({ 1286 'left': shiftSlide 1287 }, 300); 1288 $('body').animate({ 1289 'right': 0 1290 }, 300); 1291 } else { 1292 slide.animate({ 1293 'right': shiftSlide 1294 }, 300); 1295 $('body').animate({ 1296 'left': 0 1297 }, 300); 1298 } 1299 1300 overlay.fadeOut(300); 1301 1302 $('body').removeClass('side-slide-is-open'); 1303 1304 /* Just to be sure, change aria. */ 1305 if ( $('body').hasClass('keyboard-support') ) { 1306 $('#Side_slide').attr('aria-expanded', 'false'); 1307 } 1308 1309 // if page contains revolution slider, trigger resize 1310 1311 if ($('.rev_slider').length) { 1312 setTimeout(function() { 1313 $(window).trigger('resize'); 1314 }, 300); 1315 } 1316 1317 }; 1318 1319 // search 1320 1321 $('.icon.search', slide).on('click', function(e) { 1322 1323 e.preventDefault(); 1324 1325 var el = $(this); 1326 1327 if (el.hasClass('active')) { 1328 1329 $('.search-wrapper', slide).fadeOut(0); 1330 $('.menu_wrapper, .social', slide).fadeIn(300); 1331 1332 } else { 1333 1334 $('.search-wrapper', slide).fadeIn(300); 1335 $('.menu_wrapper, .social', slide).fadeOut(0); 1336 1337 $('.lang-active.active', slide).removeClass('active').children('i').attr('class', 'icon-down-open-mini'); 1338 $('.lang-wrapper', slide).fadeOut(0); 1339 1340 } 1341 1342 el.toggleClass('active'); 1343 }); 1344 1345 // search form submit 1346 1347 $('a.submit', slide).on('click', function(e) { 1348 e.preventDefault(); 1349 $('#side-form').submit(); 1350 }); 1351 1352 // lang menu 1353 1354 $('.lang-active', slide).on('click', function(e) { 1355 e.preventDefault(); 1356 1357 var el = $(this); 1358 1359 if (el.hasClass('active')) { 1360 1361 $('.lang-wrapper', slide).fadeOut(0); 1362 $('.menu_wrapper, .social', slide).fadeIn(300); 1363 el.children('i').attr('class', 'icon-down-open-mini'); 1364 1365 } else { 1366 1367 $('.lang-wrapper', slide).fadeIn(300); 1368 $('.menu_wrapper, .social', slide).fadeOut(0); 1369 el.children('i').attr('class', 'icon-up-open-mini'); 1370 1371 $('.icon.search.active', slide).removeClass('active'); 1372 $('.search-wrapper', slide).fadeOut(0); 1373 1374 } 1375 1376 el.toggleClass('active'); 1377 }); 1378 1379 // bind --- 1380 1381 // click | menu button 1382 1383 $('.responsive-menu-toggle').off('click'); 1384 1385 $('.responsive-menu-toggle').on('click', function(e) { 1386 e.preventDefault(); 1387 button(); 1388 }); 1389 1390 // click | close 1391 1392 overlay.on('click', function(e) { 1393 close(); 1394 }); 1395 1396 $('.close', slide).on('click', function(e) { 1397 e.preventDefault(); 1398 close(); 1399 }); 1400 1401 $(slide).on('click', '.menu_wrapper a:not(.menu-toggle), .action_button', function(e) { 1402 1403 if( $(this).hasClass('mega-menu-link') ){ 1404 return; // FIX: plugin maxmegamenu 1405 } 1406 1407 if( '#' == $(this).attr('href') ){ 1408 e.preventDefault(); 1409 return; 1410 } 1411 1412 setTimeout(function(){ 1413 close(); 1414 },500); 1415 1416 }); 1417 1418 // click | below search or languages menu 1419 1420 $(slide).on('click', function(e) { 1421 if ($(e.target).is(slide)) { 1422 reset(300); 1423 } 1424 }); 1425 1426 // debouncedresize 1427 1428 $(window).on('debouncedresize', reload); 1429 1430 // header style: shop | sticky 1431 1432 if( $('body').hasClass('header-shop') ){ 1433 1434 $(document).on('mfn:header:sticky:on', function(){ 1435 if( window.innerWidth >= ssMobileInitW ){ 1436 $('#Top_bar .menu_wrapper').css('min-height', '70px'); 1437 constructor(); 1438 } 1439 }); 1440 1441 $(document).on('mfn:header:sticky:off', function(){ 1442 if( window.innerWidth >= ssMobileInitW ){ 1443 destructor(); 1444 } 1445 }); 1446 1447 } 1448 1449 // init 1450 1451 init(); 1452 1453 } 1454 1455 if ($('body').hasClass('mobile-side-slide')) { 1456 sideSlide(); 1457 } 1458 1459 /** 1460 * Gallery | WordPress Gallery 1461 */ 1462 1463 // WordPress <= 4.9 | content 1464 1465 $('.sections_group .gallery, .elementor-section .gallery').each(function() { 1466 1467 var el = $(this); 1468 var id = el.attr('id'); 1469 1470 $('> br', el).remove(); 1471 1472 $('.gallery-icon > a', el) 1473 .wrap('<div class="image_frame scale-with-grid"><div class="image_wrapper"></div></div>') 1474 .prepend('<div class="mask"></div>') 1475 .children('img') 1476 .css('height', 'auto') 1477 .css('width', '100%'); 1478 1479 // lightbox | link to media file 1480 1481 if (el.hasClass('file')) { 1482 $('.gallery-icon a', el) 1483 .attr('rel', 'prettyphoto[' + id + ']') 1484 .attr('data-elementor-lightbox-slideshow', id); // FIX: elementor lightbox gallery 1485 } 1486 1487 // isotope for masonry layout 1488 1489 if (el.hasClass('masonry')) { 1490 1491 mfnIsotope.addIsotopeLocation({ 1492 name: 'Wordpress && Elementor - Masonry gallery', 1493 location: el, 1494 settings: { 1495 itemSelector: '.gallery-item', 1496 layoutMode: 'masonry', 1497 isOriginLeft: rtl ? false : true 1498 } 1499 }) 1500 1501 mfnIsotope.runIsotopes(); 1502 } 1503 1504 }); 1505 1506 // WordPress >
1506= 5.0 | content 1507 1508 $('.sections_group .wp-block-gallery').each(function(index) { 1509 1510 var el = $(this); 1511 var link = $('.blocks-gallery-item a, .wp-block-image a', el); 1512 1513 // lightbox | link to media file 1514 1515 if ((/\.(gif|jpg|jpeg|png)$/i).test(link.attr('href'))) { 1516 link.attr('rel', 'prettyphoto[wp5-gallery-' + index + ']'); 1517 } 1518 1519 }); 1520 1521 // widgets 1522 1523 $('.widget_media_gallery .gallery').each(function() { 1524 1525 var el = $(this); 1526 var id = el.attr('id'); 1527 1528 // lightbox | link to media file 1529 1530 $('.gallery-icon a', el).attr('rel', 'prettyphoto[widget-' + id + ']'); 1531 1532 }); 1533 1534 /** 1535 * Lightbox | PrettyPhoto 1536 */ 1537 1538 $('a[rel^="prettyphoto[portfolio]"]').each(function() { 1539 1540 var el = $(this); 1541 var parent = el.closest('.column'); 1542 var index = $('.column').index(parent); 1543 1544 el.attr('rel', 'prettyphoto[portfolio-' + index + ']'); 1545 1546 }); 1547 1548 /** 1549 * Lightbox | Magnific Popup 1550 * with prettyPhoto backward compatibility 1551 */ 1552 1553 function lightbox() { 1554 1555 var galleries = []; 1556 1557 // init 1558 1559 var init = function() { 1560 1561 if (lightboxAttr) { 1562 compatibility(); 1563 setType(); 1564 constructor(); 1565 } 1566 1567 }; 1568 1569 // backward compatibility for prettyPhoto 1570 1571 var compatibility = function() { 1572 1573 $('a[rel^="prettyphoto"], a.prettyphoto, a[rel^="prettyphoto"]').each(function() { 1574 1575 var el = $(this); 1576 var rel = el.attr('rel'); 1577 1578 if (rel) { 1579 rel = rel.replace('prettyphoto', 'lightbox'); 1580 } else { 1581 rel = 'lightbox'; 1582 } 1583 1584 el.removeClass('prettyphoto').attr('rel', rel); 1585 1586 }); 1587 1588 }; 1589 1590 // check if item is a part of gallery 1591 1592 var isGallery = function(rel) { 1593 1594 if (!rel) { 1595 return false; 1596 } 1597 1598 var regExp = /\[(?:.*)\]/; 1599 var gallery = regExp.exec(rel); 1600 1601 if (gallery) { 1602 gallery = gallery[0]; 1603 gallery = gallery.replace('[', '').replace(']', ''); 1604 return gallery; 1605 } 1606 1607 return false; 1608 }; 1609 1610 // set array of names of galleries 1611 1612 var setGallery = function(gallery) { 1613 1614 if (galleries.indexOf(gallery) == -1) { 1615 galleries.push(gallery); 1616 return true; 1617 } 1618 1619 return false; 1620 }; 1621 1622 // get file type by link 1623 1624 var getType = function(src) { 1625 1626 if (src.match(/youtube\.com\/watch/i) || src.match(/youtube\.com\/embed/i) || src.match(/youtu\.be/i)) { 1627 return 'iframe'; 1628 1629 } else if (src.match(/youtube-nocookie\.com/i)) { 1630 return 'iframe'; 1631 1632 } else if (src.match(/vimeo\.com/i)) { 1633 return 'iframe'; 1634 1635 } else if (src.match(/\biframe=true\b/i)) { 1636 return 'ajax'; 1637 1638 } else if (src.match(/\bajax=true\b/i)) { 1639 return 'ajax'; 1640 1641 } else if (src.substr(0, 1) == '#') { 1642 return 'inline'; 1643 1644 } else { 1645 return 'image'; 1646 1647 } 1648 }; 1649 1650 // set file type 1651 1652 var setType = function() { 1653 1654 $('a[rel^="lightbox"]').each(function() { 1655 1656 var el = $(this); 1657 var href = el.attr('href'); 1658 var rel = el.attr('rel'); 1659 1660 // FIX: WPBakery Page Builder duplicated lightbox 1661 if ( el.closest('.wpb_column').length ){ 1662 // return true; 1663 } 1664 1665 if (href) { 1666 1667 // gallery 1668 1669 var gallery = isGallery(rel); 1670 1671 if (gallery) { 1672 el.attr('data-type', 'gallery'); 1673 setGallery(gallery); 1674 return true; 1675 } 1676 1677 el.attr('data-type', getType(href)); 1678 1679 // iframe paremeters 1680 1681 if (getType(href) == 'iframe') { 1682 el.attr('href', href.replace('&rel=0', '')); 1683 } 1684 } 1685 1686 }); 1687 1688 }; 1689 1690 // constructor 1691 1692 var constructor = function() { 1693 1694 // Dividing plugins into separate files fix 1695 if( !galleries.length 1696 && !$('a[rel^="lightbox"][data-type="image"]').length 1697 && !$('a[rel^="lightbox"][data-type="iframe"]').length 1698 && !$('a[rel^="pdf-lightbox"]').length 1699 && !$('a[rel^="lightbox"][data-type="inline"]').length 1700 ) return; 1701 1702 var attr = { 1703 autoFocusLast: false, 1704 removalDelay: 160, 1705 image: { 1706 titleSrc: function(item) { 1707 var img = item.el.closest('.image_wrapper, li').find('img').first(); 1708 if (lightboxAttr.title && img.length) { 1709 return img.attr('alt'); 1710 } else { 1711 return false;
1712 } 1713 } 1714 } 1715 }; 1716 1717 // image 1718 1719 $('a[rel^="lightbox"][data-type="image"]').magnificPopup({ 1720 autoFocusLast: attr.autoFocusLast, 1721 removalDelay: attr.removalDelay, 1722 type: 'image', 1723 image: attr.image 1724 }); 1725 1726 // iframe | video 1727 1728 $('a[rel^="lightbox"][data-type="iframe"]').magnificPopup({ 1729 autoFocusLast: attr.autoFocusLast, 1730 removalDelay: attr.removalDelay, 1731 type: 'iframe', 1732 iframe: { 1733 patterns: { 1734 youtube: { 1735 index: 'youtube.com/', 1736 id: 'v=', 1737 src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0' 1738 }, 1739 youtu_be: { 1740 index: 'youtu.be/', 1741 id: '/', 1742 src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0' 1743 }, 1744 nocookie: { 1745 index: 'youtube-nocookie.com/embed/', 1746 id: '/', 1747 src: '//www.youtube-nocookie.com/embed/%id%?autoplay=1&rel=0' 1748 } 1749 } 1750 } 1751 }); 1752 1753 // pdf 1754 1755 $('a[rel^="pdf-lightbox"]').magnificPopup({ 1756 autoFocusLast: attr.autoFocusLast, 1757 removalDelay: attr.removalDelay, 1758 type: 'iframe' 1759 }); 1760 1761 // inline 1762 1763 $('a[rel^="lightbox"][data-type="inline"]').magnificPopup({ 1764 autoFocusLast: attr.autoFocusLast, 1765 type: 'inline', 1766 midClick: true, 1767 callbacks: { 1768 open: function() { 1769 $('.mfp-content').children().addClass('mfp-inline'); 1770 }, 1771 beforeClose: function() { 1772 $('.mfp-content').children().removeClass('mfp-inline'); 1773 } 1774 } 1775 }); 1776 1777 // gallery 1778 1779 for (var i = 0, len = galleries.length; i < len; i++) { 1780 1781 var gallery = '[' + galleries[i] + ']'; 1782 gallery = 'a[rel^="lightbox' + gallery + '"]:visible'; 1783 1784 $(gallery).magnificPopup({ 1785 autoFocusLast: attr.autoFocusLast, 1786 removalDelay: attr.removalDelay, 1787 type: 'image', 1788 image: attr.image, 1789 gallery: { 1790 enabled: true, 1791 tCounter: '<span class="mfp-counter">%curr% / %total%</span>' // markup of counter 1792 } 1793 }); 1794 } 1795 1796 // FIX: elementor | disable in Elementor wrapper 1797 1798 $('.elementor-page a[rel^="lightbox"]:not([data-type="gallery"]):not(.popup-link)').off('click'); 1799 1800 // FIX: WPBakery | disable if WPBakery lighbox is active 1801 1802 setTimeout(function(){ 1803 1804 var $doc = $('body'); 1805 var $events = $._data($doc[0],"events"); 1806 1807 if($events && $events.click){ 1808 for(var i=$events.click.length-1; i>=0; i--){ 1809 var handler = $events.click[i]; 1810 if( handler && handler.selector && handler.selector.indexOf('lightbox') !== -1 ){ 1811 $('.wpb_column a[rel^="lightbox"]:not(.popup-link)').off('click'); 1812 } 1813 } 1814 } 1815 1816 },0); 1817 1818 }; 1819 1820 // reload 1821 1822 var reload = function() { 1823 1824 $('a[rel^="lightbox"]').off('click'); 1825 constructor(); 1826 1827 }; 1828 1829 // init 1830 1831 init(); 1832 1833 // isotope:arrange 1834 1835 mfnIsotope.addEventListener('arrange', reload); 1836 1837 // ajaxComplete 1838 1839 $(document).ajaxComplete(function() { 1840 reload(); 1841 }); 1842 1843 } 1844 1845 lightbox(); 1846 1847 /** 1848 * Menu | mfnMenu 1849 */ 1850 1851 function mainMenu() { 1852 1853 var mmMobileInitW = mobileInitW; 1854 1855 if ($('body').hasClass('header-simple') || $('#Header_creative.dropdown').length) { 1856 mmMobileInitW = 9999; 1857 } 1858 1859 $('#menu > ul.menu').mfnMenu({ 1860 addLast: true, 1861 arrows: true, 1862 mobileInit: mmMobileInitW, 1863 responsive: mfn.responsive 1864 }); 1865 1866 $('#secondary-menu > ul.secondary-menu').mfnMenu({ 1867 mobileInit: mmMobileInitW, 1868 responsive: mfn.responsive 1869 }); 1870 1871 } 1872 1873 mainMenu(); 1874 1875 /** 1876 * Menu | NOT One Page | .scroll item 1877 * Works with .scroll class 1878 * Since 4.8 replaced with: Page Options > One Page | function: onePageMenu() 1879 */ 1880 1881 function onePageScroll() { 1882 if (!$('body').hasClass('one-page')) { 1883 var menu = $('#menu'); 1884 1885 if (menu.find('li.scroll').length > 1) { 1886 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'); 1887 1888 // menu item click 1889 menu.on('click','a',function() { 1890 $(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'); 1891 $(this).closest('li').addClass('current-menu-item'); 1892 }); 1893 } 1894 } 1895 } 1896 onePageScroll(); 1897 1898 /** 1899 * Menu | One Page | Active on Scroll & Click 1900 */ 1901 1902 function onePageMenu() { 1903 if ($('body').hasClass('one-page')) { 1904 1905 var menu = $('#menu'); 1906 if( $('#mfn-header-template').length ) menu = $('#mfn-header-template .mfn-header-menu.mfn-header-mainmenu'); 1907 1908 // add attr [data-hash] & [data-id] 1909 1910 $('a[href]', menu).each(function() { 1911 1912 var url = $(this).attr('href'); 1913 if (url && url.split('#')[1]) { 1914 1915 // data-hash 1916 var hash = '#' + url.split('#')[1]; 1917 if (hash && $(hash).length) { 1918 // check if element with specified ID exists 1919 $(this).attr('data-hash', hash); 1920 $(hash).attr('data-id', hash); 1921 } 1922 1923 // Visual Composer 1924 var vcHash = '#' + url.split('#')[1]; 1925 var vcClass = '.vc_row.' + url.split('#')[1]; 1926 if (vcClass && $(vcClass).length) { 1927 // check if element with specified Class exists 1928 $(this).attr('data-hash', vcHash); 1929 $(vcClass).attr('data-id', vcHash); 1930 } 1931 1932 } 1933 1934 }); 1935 1936 // active 1937 1938 var hash; 1939 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'; 1940 var activeClasses = 'current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor'; 1941 1942 if ($(activeSelector, menu).length) { 1943 1944 // remove duplicated 1945 $(activeSelector, menu) 1946 .not(':first').removeClass(activeClasses); 1947 1948 // remove if 1st link to section & section is not visible 1949 hash = $(activeSelector, menu).find('a[data-hash]').attr('data-hash'); 1950 1951 if (hash) { 1952 hash = '[data-id="' + hash + '"]'; 1953 1954 if ($(hash).length && $(hash).visible(true)) { 1955 // do nothing 1956 } else { 1957 $(activeSelector, menu).removeClass('current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor') 1958 .closest('li').removeClass('current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor'); 1959 } 1960 } else { 1961 // do nothing 1962 } 1963 1964 } else { 1965 1966 // add to first if none is active 1967 var first = $('li:first-child', menu); 1968 var firstA = first.children('a'); 1969 1970 if (firstA.attr('data-hash')) { 1971 hash = firstA.attr('data-hash'); 1972 hash = '[data-id="' + hash + '"]'; 1973 1974 if ($(hash).length && ($(hash).offset().top == adminBarH())) { 1975 first.addClass('current-menu-item'); 1976 } 1977 } 1978 1979 } 1980 1981 // click 1982 1983 var menu_item = $('#menu a[data-hash]'); 1984 if( $('#mfn-header-template').length ) menu_item = $('#mfn-header-template .mfn-header-menu.mfn-header-mainmenu a[data-hash]'); 1985 1986 menu_item.on('click', function(e) { 1987 e.preventDefault(); // only with: body.one-page 1988 1989 if( $('html').hasClass('mfn-header-tmpl-burger-sidebar-opened') ){ 1990 $('html').removeClass('mfn-header-tmpl-burger-sidebar-opened'); 1991 } 1992 1993 // active 1994 1995 menu.find('li').removeClass('current-menu-item'); 1996 $(this) 1997 .closest('li').addClass('current-menu-item') 1998 .closest('.menu > li').addClass('current-menu-item'); 1999 2000 var hash = $(this).attr('data-hash'); 2001 hash = '[data-id="' + hash + '"]'; 2002 2003 // mobile - sticky header - close menu 2004 2005 if ( window.innerWidth < 768 ) { 2006 $('.responsive-menu-toggle').removeClass('active'); 2007 $('#Top_bar #menu').hide(); 2008 } 2009 2010 // offset 2011 2012 var headerFixedAbH = $('.header-fixed.ab-show #Action_bar').innerHeight() || 0; 2013 var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight() || 0; 2014 2015 var offset = headerFixedAbH + tabsHeaderH + adminBarH(); 2016 2017 // sticky height 2018 2019 var stickyH = fixStickyHeaderH(); 2020 2021 // FIX | Header below | 1st section 2022 if ($('body').hasClass('header-below') && $('#Content').length) { 2023 if ($(hash).offset().top < ($('#Content').offset().top + 60)) { 2024 stickyH = -1; 2025 } 2026 } 2027 2028 // animate scroll 2029 2030 $('html, body').animate({
2031 scrollTop: $(hash).offset().top - offset - stickyH 2032 }, 500); 2033 2034 }); 2035 2036 } 2037 } 2038 onePageMenu(); 2039 2040 /** 2041 * Header | Creative 2042 */ 2043 2044 var cHeader = 'body:not( .header-open ) #Header_creative', 2045 cHeaderEl = $(cHeader), 2046 cHeaderCurrnet; 2047 2048 function creativeHeader() { 2049 2050 $('.creative-menu-toggle').on('click', function(e) { 2051 e.preventDefault(); 2052 2053 cHeaderEl.addClass('active'); 2054 $('.creative-menu-toggle, .creative-social', cHeaderEl).fadeOut(500); 2055 $('#Action_bar', cHeaderEl).fadeIn(500); 2056 2057 }); 2058 2059 } 2060 creativeHeader(); 2061 2062 $(document).on('mouseenter', cHeader, function() { 2063 cHeaderCurrnet = 1; 2064 }); 2065 2066 $(document).on('mouseleave', cHeader, function() { 2067 cHeaderCurrnet = null; 2068 setTimeout(function() { 2069 if (!cHeaderCurrnet) { 2070 2071 cHeaderEl.removeClass('active'); 2072 $('.creative-menu-toggle, .creative-social', cHeaderEl).fadeIn(500); 2073 $('#Action_bar', cHeaderEl).fadeOut(500); 2074 2075 } 2076 }, 1000); 2077 }); 2078 2079 // Fix: Header Creative & Mobile Sticky | On Resize > 768 px 2080 function creativeHeaderFix() { 2081 if ( $('body').hasClass('header-creative') && window.innerWidth >= 768 ) { 2082 if ($('#Top_bar').hasClass('is-sticky')) { 2083 $('#Top_bar').removeClass('is-sticky'); 2084 } 2085 } 2086 } 2087 2088 /** 2089 * Header | Menu Burger 2090 */ 2091 2092 $(document).on("click", ".mfn-header-tmpl .mfn-header-menu-toggle", function(e) { 2093 e.preventDefault(); 2094 2095 if( $(this).closest('.mcb-column').hasClass('mfn-header-tmpl-menu-active') ){ 2096 $(document).unbind('click', hideSidebarTmplBurger); 2097 $(this).closest('.mcb-column').removeClass('mfn-header-tmpl-menu-active'); 2098 removeBringToFront(); 2099 $('html').removeClass('mfn-header-tmpl-burger-sidebar-opened'); 2100 }else{ 2101 $(document).bind('click', hideSidebarTmplBurger); 2102 $(this).closest('.mcb-column').addClass('mfn-header-tmpl-menu-active'); 2103 $(this).closest('.mcb-column').addClass('mfn-bring-to-front'); 2104 $(this).closest('.mcb-wrap').addClass('mfn-bring-to-front'); 2105 $(this).closest('.mcb-section').addClass('mfn-bring-to-front'); 2106 $('html').addClass('mfn-header-tmpl-burger-sidebar-opened'); 2107 } 2108 2109 }); 2110 2111 $(document).on("click", ".one-page .mfn-header-tmpl-menu-sidebar .mfn-header-menu .mfn-menu-li a", function(e) { 2112 let href = $(this).attr('href'); 2113 if( $('body').hasClass('one-page') && href.includes('#') && $(href).length ) { 2114 e.preventDefault(); 2115 let header_h = 0; 2116 if( $('.mfn-header-tmpl.mfn-header-main').hasClass('mfn-header-tmpl-fixed') || $('.mfn-header-tmpl.mfn-header-main').hasClass('mfn-hasSticky') ){ 2117 header_h = $('.mfn-header-tmpl.mfn-header-main').outerHeight(); 2118 } 2119 let scroll_offset = $(href).offset().top - header_h; 2120 $('body, html').animate({ scrollTop: scroll_offset }, 500); 2121 $(document).unbind('click', hideSidebarTmplBurger); 2122 $(this).closest('.mcb-column').removeClass('mfn-header-tmpl-menu-active'); 2123 removeBringToFront(); 2124 if( $('html').hasClass('mfn-header-tmpl-burger-sidebar-opened') ){ 2125 $('html').removeClass('mfn-header-tmpl-burger-sidebar-opened'); 2126 } 2127 } 2128 }); 2129 2130 function hideSidebarTmplBurger(e){ 2131 var div = $('.mfn-header-tmpl-menu-sidebar'); 2132 2133 if (!div.is(e.target) && div.has(e.target).length === 0){ 2134 $('.mfn-header-tmpl-menu-active').removeClass('mfn-header-tmpl-menu-active'); 2135 $(document).unbind('click', hideSidebarTmplBurger); 2136 removeBringToFront(); 2137 $('html').removeClass('mfn-header-tmpl-burger-sidebar-opened'); 2138 } 2139 } 2140 2141 function removeBringToFront(){ 2142 if( $('.mfn-bring-to-front').length ) { 2143 $('.mfn-bring-to-front').removeClass('mfn-bring-to-front'); 2144 } 2145 } 2146 2147 /** 2148 * Header | Search 2149 */ 2150 2151 $(document).on("click", ".mfn-header-tmpl .mfn-searchbar-toggle, .mfn-header-tmpl .search_wrapper .mfn-close-icon", function(e) { 2152 e.preventDefault(); 2153 2154 if( $(this).closest('.mcb-column-inner').hasClass('mfn-searchbar-active') ){ 2155 $(this).closest('.mcb-column-inner').removeClass('mfn-searchbar-active'); 2156 removeBringToFront(); 2157 }else{ 2158 $(this).closest('.mcb-column-inner').addClass('mfn-searchbar-active'); 2159 $(this).closest('.mcb-column').addClass('mfn-bring-to-front'); 2160 $(this).closest('.mcb-wrap').addClass('mfn-bring-to-front'); 2161 $(this).closest('.mcb-section').addClass('mfn-bring-to-front'); 2162 2163 if( $(this).closest('.mcb-column-inner').find('input.field').length ){ 2164 $(this).closest('.mcb-column-inner').find('input.field').focus(); 2165 } 2166 } 2167 2168 2169 2170 }); 2171 2172 $(".search_button:not(.has-input), #Top_bar .icon_close").on('click', function(e) { 2173 e.preventDefault(); 2174 2175 if( $(this).closest('.mfn-header-tmpl').length ){ 2176 // header template 2177 $(this).closest('.mcb-column').toggleClass('mfn-searchbar-active'); 2178 2179 }else{ 2180 const search = $('.search_wrapper') 2181 if( search.css('display') === 'none' ){ 2182 search.fadeIn().find('.field').focus(); 2183 2184 setTimeout(function(){ search.addClass('mfn-loaded') }, 300); 2185 } else{ 2186 search.fadeOut().removeClass('mfn-loaded'); 2187 } 2188 } 2189 2190 }); 2191 2192 /** 2193 * WPML | Language switcher in the WP Menu 2194 */ 2195 2196 function mfnWPML() { 2197 $('#menu .menu-item-language:not(.menu-item-language-current)').each(function() { 2198 var el = $(this).children('a'); 2199 2200 if (!el.children('span:not(.icl_lang_sel_bracket)').length) { 2201 el.wrapInner('<span></span>'); 2202 } 2203 2204 }); 2205 2206 $('#menu span.icl_lang_sel_bracket').each(function() { 2207 var el = $(this); 2208 el.replaceWith(el.html()); 2209 }); 2210 2211 } 2212 mfnWPML(); 2213 2214 /** 2215 * Breadcrumbs | Remove last item link 2216 */ 2217 2218 function breadcrumbsRemoveLastLink() { 2219 var el = $('.breadcrumbs.no-link').find('li').last(); 2220 var text = el.text(); 2221 el.html(text); 2222 } 2223 breadcrumbsRemoveLastLink(); 2224 2225 /** 2226 * Downcount 2227 */ 2228 2229 $('.downcount').each(function() { 2230 var el = $(this); 2231 el.downCount({ 2232 date: el.attr('data-date'), 2233 offset: el.attr('data-offset') 2234 }); 2235 }); 2236 2237 /** 2238 * Hover | on Touch | .tooltip, .hover_box 2239 */ 2240 2241 $('.tooltip, .hover_box') 2242 .on('touchstart', function() { 2243 $(this).toggleClass('hover'); 2244 }) 2245 .on('touchend', function() { 2246 $(this).removeClass('hover'); 2247 }); 2248 2249 /** 2250 * Popup | Contact Form | Button 2251 */ 2252 2253 $("#popup_contact .footer_button").on('click', function(e) { 2254 e.preventDefault(); 2255 $(this).parent().toggleClass('focus'); 2256 }); 2257 2258 /** 2259 * Scroll | niceScroll for Header Creative 2260 */ 2261 2262 if ( $('#Header_creative.scroll').length && window.innerWidth >= 1240 ) { 2263 $('#Header_creative.scroll').niceScroll({ 2264 autohidemode: false, 2265 cursorborder: 0,
2266 cursorborderradius: 5, 2267 cursorcolor: '#222222', 2268 cursorwidth: 0, 2269 horizrailenabled: false, 2270 mousescrollstep: 40, 2271 scrollspeed: 60 2272 }); 2273 } 2274 2275 /** 2276 * Sliding Top 2277 */ 2278 2279 $('.sliding-top-control').on('click', function(e) { 2280 e.preventDefault(); 2281 $('#Sliding-top .widgets_wrapper').slideToggle(); 2282 $('#Sliding-top').toggleClass('active'); 2283 }); 2284 2285 /** 2286 * Alert 2287 */ 2288 2289 $('body').on('click', '.alert .close', function(e) { 2290 e.preventDefault(); 2291 $(this).closest('.alert').hide(300); 2292 }); 2293 2294 /** 2295 * Navigation Arrows | Sticky 2296 */ 2297 2298 $('.fixed-nav').appendTo('body'); 2299 2300 /** 2301 * Feature List 2302 */ 2303 2304 $('.feature_list').each(function() { 2305 var col = $(this).attr('data-col') ? $(this).attr('data-col') : 4; 2306 $(this).find('li:nth-child(' + col + 'n):not(:last-child)').after('<hr />'); 2307 }); 2308 2309 /** 2310 * IE Fixes 2311 */ 2312 2313 function checkIE() { 2314 // IE 9 2315 var ua = window.navigator.userAgent; 2316 var msie = ua.indexOf("MSIE "); 2317 if (msie > 0 && parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))) == 9) { 2318 $("body").addClass("ie"); 2319 } 2320 } 2321 checkIE(); 2322 2323 /** 2324 * Parallax 2325 */ 2326 2327 var ua = navigator.userAgent, 2328 isMobileWebkit = /WebKit/.test(ua) && /Mobile/.test(ua); 2329 2330 if ( ! isMobileWebkit && window.innerWidth >= 768 ) { 2331 2332 if (mfn.parallax == 'stellar') { 2333 2334 // Stellar 2335 $.stellar({ 2336 horizontalScrolling: false, 2337 responsive: true 2338 }); 2339 2340 } else { 2341 2342 $(window).enllax(); 2343 2344 } 2345 2346 } else { 2347 2348 $('div[data-enllax-ratio], div[data-stellar-ratio]').css('background-attachment', 'scroll'); 2349 2350 } 2351 2352 /** 2353 * Load More | Ajax 2354 */ 2355 2356 $('.pager_load_more').on('click', function(e) { 2357 e.preventDefault(); 2358 2359 var el = $(this); 2360 var pager = el.closest('.pager_lm'); 2361 var href = el.attr('href'); 2362 2363 // index | for many items on the page 2364 //var index = $('.lm_wrapper').index(el.closest('.isotope_wrapper').find('.lm_wrapper')); 2365 var index = $('.lm_wrapper').index( el.closest('.mcb-column-inner').find('.lm_wrapper') ); 2366 2367 el.fadeOut(50); 2368 pager.addClass('loading'); 2369 2370 $.get( href, function( data ) { 2371 2372 // content 2373 2374 var content = $('.lm_wrapper:eq(' + index + ')', data).wrapInner('').html(); 2375 var $content = $(content); 2376 2377 href = $('.lm_wrapper:eq(' + index + ')', data).next().find('.pager_load_more').attr('href'); 2378 2379 if ($('.lm_wrapper:eq(' + index + ')').hasClass('isotope')) { 2380 // isotope 2381 const location = '.lm_wrapper:eq(' + index + ')'; 2382 $(location).append( $content ); 2383 2384 mfnIsotope.queryIsotopeAPI(location, 'appended', $content); 2385 mfnIsotope.addIsotopeLocation({ name: 'Load More - Ajax', location }) 2386 2387 } else if ($('.lm_wrapper:eq(' + index + ')').hasClass('mfn-woo-products')) { 2388 2389 $('.lm_wrapper:eq(' + index + ') ul.products').append( $content.html() ); 2390 href = $('.lm_wrapper:eq(' + index + ')', data).find('.pager_load_more').attr('href'); 2391 2392 var $listing = $('.lm_wrapper ul.products.isotope'); 2393 2394 if( $listing.length ){ 2395 $listing.imagesLoaded().progress(function() { 2396 $listing.isotope('reloadItems'); 2397 }); 2398 } 2399 2400 } else { 2401 // default 2402 $content.hide().appendTo('.lm_wrapper:eq(' + index + ')').fadeIn(1000); 2403 } 2404 2405 // next page link 2406 2407 pager.removeClass('loading'); 2408 if (href) { 2409 el.fadeIn(); 2410 el.attr('href', href); 2411 } 2412 2413 // refresh some staff 2414 2415 mfnJPlayer(); 2416 lightbox(); 2417 2418 // isotope fix: second resize 2419 2420 if( $('.lm_wrapper.isotope').length ){ 2421 $('.lm_wrapper.isotope').imagesLoaded().progress(function() { 2422 mfnIsotope.queryIsotopeAPI( '.lm_wrapper.isotope' ); 2423 }); 2424 } 2425 2426 }); 2427 2428 }); 2429 2430 /** 2431 * Filters | Blog & Portfolio 2432 */ 2433 2434 $('.filters_buttons .open').on('click', function(e) { 2435 e.preventDefault(); 2436 var type = $(this).closest('li').attr('class'); 2437 2438 $('.filters_wrapper').show(200); 2439 $('.filters_wrapper ul.' + type).show(200); 2440 $('.filters_wrapper ul:not(.' + type + ')').hide(); 2441 }); 2442 2443 $('.filters_wrapper .close a').on('click', function(e) { 2444 e.preventDefault(); 2445 $('.filters_wrapper').hide(200); 2446 }); 2447 2448 /** 2449 * Portfolio List | Next v / Prev ^ buttons 2450 */ 2451 2452 $('.portfolio_next_js').on('click', function(e) { 2453 e.preventDefault(); 2454 2455 var item = $(this).closest('.portfolio-item').next(); 2456 2457 if (item.length) { 2458 $('html, body').animate({ 2459 scrollTop: item.offset().top - fixStickyHeaderH() 2460 }, 500); 2461 } 2462 }); 2463 2464 $('.portfolio_prev_js').on('click', function(e) { 2465 e.preventDefault(); 2466 2467 var item = $(this).closest('.portfolio-item').prev(); 2468 2469 if (item.length) { 2470 $('html, body').animate({ 2471 scrollTop: item.offset().top - fixStickyHeaderH() 2472 }, 500); 2473 } 2474 }); 2475 2476 /** 2477 * Link | Smooth Scroll | .scroll 2478 */ 2479 2480 $('body').on('click', '.scroll > a, a.scroll, .mcb-column.scroll a', function(e) { 2481 2482 // prevent default if link directs to the current page 2483 2484 // var urlL = location.href.replace(/\/#.*|#.*/, ''); 2485 // var urlT = this.href.replace(/\/#.*|#.*/, ''); // remove also trailing slash 2486 2487 var urlL = location.href.replace(/#.*/, ''); 2488 var urlT = this.href.replace(/#.*/, ''); 2489 2490 if (urlL == urlT) { 2491 e.preventDefault(); 2492 } 2493 2494 var hash = this.hash; 2495 2496 // offset 2497 2498 var headerFixedAbH = $('.header-fixed.ab-show #Action_bar').innerHeight() || 0; 2499 var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight() || 0; 2500 2501 var offset = headerFixedAbH + tabsHeaderH + adminBarH(); 2502 2503 // table of contents 2504 2505 if( $(this).parents('.table_of_content').length ){ 2506 offset += 30; 2507 } 2508 2509 // animate scroll 2510 2511 if (hash && $(hash).length) { 2512 2513 // do scroll 2514 2515 $('html, body').animate({
2516 scrollTop: $(hash).offset().top - offset - fixStickyHeaderH() 2517 }, 500); 2518 } 2519 }); 2520 2521 /** 2522 * Tabs 2523 */ 2524 2525 $('.jq-tabs').tabs(); 2526 2527 /** 2528 * Fake tabs 2529 */ 2530 2531 $('.fake-tabs > ul').on('click', 'a', function(e) { 2532 e.preventDefault(); 2533 2534 var $li = $(this).closest('li'); 2535 2536 var tab = $li.data('tab'); 2537 2538 if( $li.hasClass('active') ){ 2539 return; 2540 } 2541 2542 $li.addClass('active') 2543 .siblings().removeClass('active'); 2544 2545 $('.tab-'+ tab ).addClass('active').attr('tabindex', 0) 2546 .siblings('.tab').removeClass('active').attr('tabindex', -1); 2547 2548 $(window).trigger('resize'); 2549 }); 2550 2551 /** 2552 * Accordion & FAQ 2553 */ 2554 2555 $('.mfn-acc').each(function() { 2556 var el = $(this); 2557 2558 if (el.hasClass('openAll')) { 2559 2560 // show all 2561 el.find('.question') 2562 .addClass("active") 2563 .children(".answer") 2564 .show(); 2565 2566 } else { 2567 2568 // show one 2569 var activeTab = el.attr('data-active-tab'); 2570 if (el.hasClass('open1st')) activeTab = 1; 2571 2572 if (activeTab) { 2573 el.find('.question').eq(activeTab - 1) 2574 .addClass("active") 2575 .children(".answer") 2576 .show(); 2577 } 2578 2579 } 2580 }); 2581 2582 $('.mfn-acc .question > .title').on('click', function() { 2583 2584 if ($(this).parent().hasClass("active")) { 2585 2586 $(this).parent().removeClass("active").children(".answer").slideToggle(100); 2587 2588 } else { 2589 2590 if (!$(this).closest('.mfn-acc').hasClass('toggle')) { 2591 $(this).parents(".mfn-acc").children().each(function() { 2592 if ($(this).hasClass("active")) { 2593 $(this).removeClass("active").children(".answer").slideToggle(100); 2594 } 2595 }); 2596 } 2597 $(this).parent().addClass("active"); 2598 $(this).next(".answer").slideToggle(100); 2599 2600 } 2601 2602 setTimeout(function() { 2603 $(window).trigger('resize'); 2604 }, 50); 2605 2606 }); 2607 2608 // Visual Composer | Accordion | Sidebar height 2609 $('.wpb_wrapper .vc_tta-panel-title').on('click', 'a', function() { 2610 2611 setTimeout(function() { 2612 $(window).trigger('resize'); 2613 }, 50); 2614 2615 }); 2616 2617 /** 2618 * Helper 2619 */ 2620 2621 $('.helper .link.toggle').on('click', function(e) { 2622 2623 e.preventDefault(); 2624 2625 var el = $(this); 2626 var id = el.attr('data-rel'); 2627 var parent = el.closest('.helper'); 2628 2629 if (el.hasClass('active')) { 2630 2631 el.removeClass('active'); 2632 parent.find('.helper_content > .item-' + id).slideUp(200); 2633 2634 setTimeout(function() { 2635 parent.find('.helper_content > .item-' + id).removeClass('active'); 2636 }, 200); 2637 2638 } else { 2639 2640 parent.find('.links > .link.active').removeClass('active'); 2641 parent.find('.helper_content > .item.active').slideUp(200); 2642 2643 el.addClass('active'); 2644 parent.find('.helper_content > .item-' + id).addClass('active').hide().slideDown(200); 2645 2646 } 2647 2648 setTimeout(function() { 2649 $(window).trigger('resize'); 2650 }, 50); 2651 2652 }); 2653 2654 /** 2655 * HTML5 Video | jPlayer 2656 */ 2657 2658 function mfnJPlayer() { 2659 $('.mfn-jplayer').each(function() { 2660 2661 var m4v = $(this).attr('data-m4v'), 2662 poster = $(this).attr('data-img'), 2663 swfPath = $(this).attr('data-swf'), 2664 cssSelectorAncestor = '#' + $(this).closest('.mfn-jcontainer').attr('id'); 2665 2666 $(this).jPlayer({ 2667 ready: function() { 2668 $(this).jPlayer('setMedia', { 2669 m4v: m4v, 2670 poster: poster 2671 }); 2672 }, 2673 play: function() { 2674 // To avoid both jPlayers playing together. 2675 $(this).jPlayer('pauseOthers'); 2676 }, 2677 size: { 2678 cssClass: 'jp-video-360p', 2679 width: '100%', 2680 height: '360px' 2681 }, 2682 swfPath: swfPath, 2683 supplied: 'm4v', 2684 cssSelectorAncestor: cssSelectorAncestor, 2685 wmode: 'opaque' 2686 }); 2687 }); 2688 } 2689 mfnJPlayer(); 2690 2691 /** 2692 * Love 2693 */ 2694 2695 $('body').on('click', '.mfn-love', function() { 2696 var el = $(this); 2697 2698 if (el.hasClass('loved')) { 2699 return false;
2700 } 2701 el.addClass('loved'); 2702 2703 var post = { 2704 action: 'mfn_love', 2705 post_id: el.attr('data-id') 2706 }; 2707 2708 $.post(mfn.ajax, post, function(data) { 2709 el.find('.label').html(data); 2710 }); 2711 2712 return false; 2713 }); 2714 2715 /** 2716 * Go to top 2717 */ 2718 2719 $('#back_to_top').on('click', function() { 2720 $('body,html').animate({ 2721 scrollTop: 0 2722 }, 500); 2723 return false; 2724 }); 2725 2726 /** 2727 * Section | Next v / Prev ^ navigation arrows 2728 */ 2729 2730 $('.section .section-nav').on('click', function() { 2731 2732 var el = $(this); 2733 var section = el.closest('.section'); 2734 2735 var offset = fixStickyHeaderH() + adminBarH(); 2736 2737 if (el.hasClass('prev')) { 2738 2739 // Previous Section 2740 if (section.prev().length) { 2741 $('html, body').animate({ 2742 scrollTop: section.prev().offset().top - offset 2743 }, 500); 2744 } 2745 2746 } else { 2747 2748 // Next Section 2749 if (section.next().length) { 2750 $('html, body').animate({ 2751 scrollTop: section.next().offset().top - offset 2752 }, 500); 2753 } 2754 2755 } 2756 }); 2757 2758 /** 2759 * Intro | Scroll v arrow 2760 */ 2761 2762 $('#Intro .intro-next').on('click', function() { 2763 var intro = $(this).closest('#Intro'); 2764 2765 if (intro.next().length) { 2766 $('html, body').animate({ 2767 scrollTop: intro.next().offset().top - fixStickyHeaderH() - adminBarH() 2768 }, 500); 2769 } 2770 }); 2771 2772 /** 2773 * Widget | Muffin Menu | Hover on click 2774 */ 2775 2776 $('.widget_mfn_menu ul.submenus-click').each(function() { 2777 2778 var el = $(this); 2779 2780 $('a', el).on('click', function(e) { 2781 var li = $(this).closest('li'); 2782 2783 if (li.hasClass('hover') || !li.hasClass('menu-item-has-children')) { 2784 // link click 2785 } else { 2786 e.preventDefault(); 2787 li.siblings('li').removeClass('hover') 2788 .find('li').removeClass('hover'); 2789 $(this).closest('li').addClass('hover'); 2790 } 2791 2792 }); 2793 2794 }); 2795 2796 /** 2797 * WooCommerce | Add to cart 2798 */ 2799 2800 function addToCart() { 2801 2802 $('body').on('click', '.add_to_cart_button', function() { 2803 $(this) 2804 .closest('.product') 2805 .addClass('adding-to-cart') 2806 .removeClass('added-to-cart'); 2807 }); 2808 2809 $('body').on('added_to_cart', function() { 2810 $('.adding-to-cart') 2811 .removeClass('adding-to-cart') 2812 .addClass('added-to-cart'); 2813 }); 2814 } 2815 addToCart(); 2816 2817 /** 2818 * WooCommerce | Rating click 2819 */ 2820 2821 $('.woocommerce-product-rating').on('click', function(){ 2822 2823 var el; 2824 2825 if( $('.product_tabs_wrapper.fake-tabs').length ){ 2826 2827 el = $('.product_tabs_wrapper.fake-tabs'); 2828 $('li[data-tab="reviews"] a', el).trigger('click'); 2829 2830 } else if( $('.woocommerce-content .jq-tabs').length ){ 2831 2832 el = $('.woocommerce-content .jq-tabs'); 2833 $('.ui-tabs-nav a[href="#tab-reviews"]', el).trigger('click'); 2834 2835 } else { 2836 2837 el = $('.woocommerce-content .accordion'); 2838 $('#reviews').closest('.question:not(.active)').children('.title').trigger('click'); 2839 2840 } 2841 2842 // offset 2843 2844 var actionBarH = $('.header-fixed.ab-show #Action_bar').innerHeight() || 0; 2845 var offset = actionBarH + adminBarH(); 2846 2847 // animate scroll 2848 2849 $('html, body').animate({ 2850 scrollTop: el.offset().top - offset - fixStickyHeaderH() 2851 }, 500); 2852 2853 }); 2854 2855 /** 2856 * WooCommerce | Quantity change 2857 */ 2858 2859 $('body').on('click', '.quantity-change', function(e){ 2860 2861 e.preventDefault(); 2862 2863 var $el = $(this), 2864 $input = $(this).siblings('input'); 2865 2866 var step = parseFloat($input.attr('step')) || 1, 2867 minAttr = $input.attr('min'), 2868 min = typeof minAttr !== typeof undefined && minAttr !== false ? parseFloat(minAttr) : 1, 2869 max = parseFloat($input.attr('max')) || 9999, 2870 current = $input.val() ? parseFloat($input.val()) : min, 2871 val = 0; 2872 2873 if( $el.hasClass('plus') ){ 2874 val = current + step; 2875 if( val > max ){ 2876 val = current; 2877 } 2878 } else { 2879 val = current - step; 2880 if( val < min ){ 2881 val = current; 2882 } 2883 } 2884 2885 val = Math.round(val * 10) / 10; 2886 2887 $input.val(val).trigger('change'); 2888 2889 }); 2890 2891 /** 2892 * Ajax | Complete 2893 */ 2894 2895 $(document).ajaxComplete(function() { 2896 2897 setTimeout(function() { 2898 $(window).trigger('resize'); 2899 mfnSidebar(); 2900 }, 100); 2901 2902 }); 2903 2904 /** 2905 * $(window).on('debouncedresize') 2906 * Specify a function to execute on window resize 2907 */ 2908 2909 $(window).on('debouncedresize', function() { 2910 2911 // isotope 2912 mfnIsotope.runIsotopes( false ); 2913 2914 // sliding footer height 2915 2916 mfnFooter(); 2917 2918 // header width 2919 2920 headerWidth(); 2921 2922 // sidebar height 2923 2924 mfnSidebar(); 2925 2926 // intro header 2927 2928 mfnIntroH(); 2929 2930 // mobile sticky for header creative 2931 2932 creativeHeaderFix(); 2933 2934 }); 2935 2936 /** 2937 * document.ready 2938 * Initialize document ready functions 2939 */ 2940 2941 mfnSliderBlog(); 2942 mfnSliderClients(); 2943 mfnSliderOffer(); 2944 mfnSliderOfferThumb(); 2945 mfnSliderShop(); 2946 2947 sliderPortfolio(); 2948 sliderTestimonials(); 2949 2950 // sliding footer height 2951 2952 mfnFooter(); 2953 2954 // header width 2955 2956 headerWidth(); 2957 2958 // sidebar height 2959 2960 mfnSidebar(); 2961 2962 // intro header 2963 2964 mfnIntroH(); 2965 2966 // hash navigation 2967 2968 hashNav(); 2969 2970 // GDPR container display 2971 2972 gdpr(); 2973 2974 // table of contents 2975 tableContentAttachId(); 2976 2977 }); 2978 2979 /** 2980 * $(window).on('scroll') 2981 * The scroll event is sent to an element when the user scrolls to a different place in the element. 2982 */ 2983 2984 $(window).on('scroll', function() { 2985 2986 // sticky header 2987 2988 mfnSticky(); 2989 mfnMobileSticky(); 2990 2991 // sticky back to top 2992 2993 backToTopSticky(); 2994 2995 // one page scroll active 2996 2997 onePageActive(); 2998 2999 // sticky wrap 3000 3001 stickyWrap.scroll(); 3002 3003 }); 3004 3005 /** 3006 * $(window).on('load') 3007 * window.load 3008 */ 3009 3010 $(window).on('load', function() { 3011 3012 // align divs heights 3013 3014 alignHeights(); 3015 3016 /** 3017 * Elementor plugin 3018 * Disable built-in one page 3019 */ 3020 3021 function elementorDisableOnePage(){ 3022 3023 if( ! $('body').hasClass('one-page') ){ 3024 return false;
3025 } 3026 3027 setTimeout(function(){ 3028 var doc=$(document), 3029 $events=$("a[href*='#']").length ? $._data(doc[0],"events") : null; 3030 if($events && $events.click){ 3031 for(var i=$events.click.length-1; i>=0; i--){ 3032 var handler=$events.click[i]; 3033 if(handler && handler.namespace != "mPS2id" && handler.selector === 'a[href*="#"]' ) doc.off("click",handler.handler); 3034 } 3035 } 3036 }, 300); 3037 3038 } 3039 3040 elementorDisableOnePage(); 3041 3042 /** 3043 * Live search item 3044 * z-index for live search item parents 3045 */ 3046 3047 function liveSearchItemZindex(){ 3048 3049 $('.column_livesearch').each(function(){ 3050 $(this).closest('.mcb-wrap').addClass('has-live-search-element') 3051 .closest('.mcb-section').addClass('has-live-search-element'); 3052 }); 3053 3054 } 3055 3056 liveSearchItemZindex(); 3057 3058 /** 3059 * Retina Logo 3060 */ 3061 3062 function retinaLogo() { 3063 3064 // ! retina display 3065 3066 if( window.devicePixelRatio <= 1 ){ 3067 return false; 3068 } 3069 3070 var el, src, height, 3071 parent = $('#Top_bar #logo'), 3072 parentH = parent.data('height'); 3073 3074 var maxH = { 3075 sticky: { 3076 init: 35, 3077 noPadding: 60, 3078 overflow: 110 3079 }, 3080 mobile: { 3081 mini: 50, 3082 miniNoPadding: 60 3083 }, 3084 mobileSticky: { 3085 init: 50, 3086 noPadding: 60, 3087 overflow: 80 3088 } 3089 }; 3090 3091 $('#Top_bar #logo img').each(function(index) { 3092 3093 el = $(this); 3094 src = el.data('retina'); 3095 height = el.height() || 0; 3096 3097 // main 3098 3099 if (el.hasClass('logo-main')) { 3100 3101 if ($('body').hasClass('logo-overflow')) { 3102 3103 // do nothing 3104 3105 } else if (height > parentH) { 3106 3107 height = parentH; 3108 3109 } 3110 3111 } 3112 3113 // sticky 3114 3115 if (el.hasClass('logo-sticky')) { 3116 3117 if ($('body').hasClass('logo-overflow')) { 3118 3119 if (height > maxH.sticky.overflow) { 3120 height = maxH.sticky.overflow; 3121 } 3122 3123 } else if ($('body').hasClass('logo-no-sticky-padding')) { 3124 3125 if (height > maxH.sticky.noPadding) { 3126 height = maxH.sticky.noPadding; 3127 } 3128 3129 } else if (height > maxH.sticky.init) { 3130 3131 height = maxH.sticky.init; 3132 3133 } 3134 3135 } 3136 3137 // mobile 3138 3139 if (el.hasClass('logo-mobile')) { 3140 3141 if ($('body').hasClass('mobile-header-mini')) { 3142 3143 if (parent.data('padding') > 0) { 3144 3145 if (height > maxH.mobile.mini) { 3146 height = maxH.mobile.mini; 3147 } 3148 3149 } else { 3150 3151 if (height > maxH.mobile.miniNoPadding) { 3152 height = maxH.mobile.miniNoPadding; 3153 } 3154 3155 } 3156 3157 } 3158 3159 } 3160 3161 // mobile-sticky 3162 3163 if (el.hasClass('logo-mobile-sticky')) { 3164 3165 if ($('body').hasClass('logo-no-sticky-padding')) { 3166 3167 if (height > maxH.mobileSticky.noPadding) { 3168 height = maxH.mobileSticky.noPadding; 3169 } 3170 3171 } else if (height > maxH.mobileSticky.init) { 3172 height = maxH.mobileSticky.init; 3173 } 3174 3175 } 3176 3177 // SET 3178 3179 if (src) { 3180 el.parent().addClass('retina'); 3181 el.attr('src', src).css('max-height', height + 'px'); 3182 } 3183 3184 }); 3185 3186 } 3187 3188 setTimeout(function() { 3189 retinaLogo(); 3190 }, 0); // jQuery 3.5 window.load 3191 3192 /** 3193 * Before After | TwentyTwenty 3194 */ 3195 3196 $('.before_after.twentytwenty-container').each(function(){ 3197 3198 var el = $(this); 3199 3200 el.imagesLoaded().done(function(instance, image){ 3201 3202 // setTimeout(function(){ 3203 // el.twentytwenty(); 3204 // },500); 3205 3206 queueMicrotask(() => el.twentytwenty()); 3207 3208 }); 3209 3210 }); 3211 3212 // Visual Composer prettyPhoto | off 3213 3214 if ( lightboxAttr ) { 3215 $('a[data-rel^="prettyPhoto"]:not(.popup-link), a[rel^="lightbox"]:not(.popup-link)').each(function() { 3216 $(this).off('click.prettyphoto'); 3217 }); 3218 } 3219 3220 /** 3221 * Reload some functions on window.load 3222 */ 3223 3224 // sticky header 3225 3226 mfnStickyH(); 3227 mfnSticky(); 3228 mfnMobileSticky(); 3229 3230 // intro header 3231 3232 mfnIntroH(); 3233 3234 // FIX | jQuery 3.5 window.load 3235 3236 setTimeout(function() { 3237
3238 // triger resize to recalculate some plugins stuff 3239 $(window).trigger('resize'); 3240 3241 // sidebar height 3242 3243 mfnSidebar(); 3244 3245 // sliders 3246 3247 sliderSlider(); 3248 3249 // hash navigation 3250 3251 hashNav(); 3252 3253 // sticky wrap 3254 stickyWrap.init(); 3255 3256 }, 0); 3257 3258 }); 3259 3260 /** 3261 * $(document).on('mouseup') 3262 * Specify a function to execute when the DOM is fully loaded. 3263 * Close some modals when click outside 3264 */ 3265 3266 $(document).on('mouseup',function(e) { 3267 3268 // Widget | Muffin menu | Hover on click 3269 3270 if ($('.widget_mfn_menu ul.submenus-click').length && ($('.widget_mfn_menu ul.submenus-click').has(e.target).length === 0) ) { 3271 $('.widget_mfn_menu ul.submenus-click li').removeClass('hover'); 3272 } 3273 3274 // Mobile menu | Classic 3275 3276 if ($('.menu_wrapper').length && ( $('.menu_wrapper').has(e.target).length === 0 )) { 3277 if( $('.responsive-menu-toggle').hasClass('active') ){ 3278 $('.responsive-menu-toggle').trigger('click'); 3279 } 3280 } 3281 3282 // Popup contact form 3283 3284 if ($('#popup_contact').length && ( $('#popup_contact').has(e.target).length === 0 )) { 3285 if( $('#popup_contact').hasClass('focus') ){ 3286 $('#popup_contact .footer_button').trigger('click'); 3287 } 3288 } 3289 3290 // Off canvas sidebar 3291 3292 if($('html').hasClass('mfn-ofcs-opened') && !$('.mfn-off-canvas-sidebar').is(e.target) && $('.mfn-off-canvas-sidebar').has(e.target).length === 0){ 3293 $('html').removeClass('mfn-ofcs-opened'); 3294 } 3295 3296 }); 3297 3298 /** 3299 * Sliders configuration 3300 */ 3301 3302 // Slick Slider | Auto responsive 3303 3304 function slickAutoResponsive(slider, max, size, round = false) { 3305 3306 if (!max){ 3307 max = 5; 3308 } 3309 if (!size){ 3310 size = 380; 3311 } 3312 3313 var width = slider.width() || 0; 3314 var count; 3315 3316 if ( round ) { 3317 count = Math.floor(width / size); 3318 } else { 3319 count = Math.ceil(width / size); 3320 } 3321 3322 if (count < 1) count = 1; 3323 if (count > max) count = max; 3324 3325 return count; 3326 } 3327 3328 // Slider | Offer Thumb 3329 3330 function mfnSliderOfferThumb() { 3331 3332 var pager = function(el, i) { 3333 var img = $(el.$slides[i]).find('.thumbnail:first').html(); 3334 return '<a>' + img + '</a>'; 3335 }; 3336 3337 $('.offer_thumb_ul').each(function() { 3338 3339 var slider = $(this); 3340 3341 slider.slick({ 3342 cssEase: 'ease-out', 3343 arrows: false, 3344 dots: true, 3345 infinite: true, 3346 touchThreshold: 10, 3347 speed: 300, 3348 3349 adaptiveHeight: true, 3350 appendDots: slider.siblings('.slider_pagination'), 3351 customPaging: pager, 3352 3353 rtl: rtl ? true : false, 3354 autoplay: mfn.slider.offer ? true : false, 3355 autoplaySpeed: mfn.slider.offer ? mfn.slider.offer : 5000, 3356 3357 slidesToShow: 1, 3358 slidesToScroll: 1 3359 }); 3360 3361 }); 3362 } 3363 3364 // Slider | Offer 3365 3366 function mfnSliderOffer() { 3367 $('.offer_ul').each(function() { 3368 3369 var slider = $(this); 3370 3371 slider.slick({ 3372 cssEase: 'ease-out', 3373 dots: false, 3374 infinite: true, 3375 touchThreshold: 10, 3376 speed: 300, 3377 3378 prevArrow: '<a class="slider_prev" href="#"><span class="button_icon"><i class="icon-up-open-big" aria-label="previous slide"></i></span></a>', 3379 nextArrow: '<a class="slider_next" href="#"><span class="button_icon"><i class="icon-down-open-big" aria-label="next slide"></i></span></a>', 3380 3381 adaptiveHeight: true, 3382 //customPaging : pager, 3383 3384 rtl: rtl ? true : false, 3385 autoplay: mfn.slider.offer ? true : false, 3386 autoplaySpeed: mfn.slider.offer ? mfn.slider.offer : 5000, 3387 3388 slidesToShow: 1, 3389 slidesToScroll: 1 3390 }); 3391 3392 // Pagination | Show (css) 3393 3394 slider.siblings('.slider_pagination').addClass('show'); 3395 3396 // Pager | Set slide number after change 3397 3398 slider.on('afterChange', function(event, slick, currentSlide, nextSlide) { 3399 slider.siblings('.slider_pagination').find('.current').text(currentSlide + 1); 3400 }); 3401 3402 }); 3403 } 3404 3405 // Slider | Shop 3406 3407 function mfnSliderShop() { 3408 3409 var pager = function(el, i) { 3410 return '<a>' + i + '</a>'; 3411 }; 3412 3413 $('.shop_slider_ul').each(function() { 3414 3415 var slider = $(this); 3416 var slidesToShow = 4; 3417 3418 var count = slider.closest('.shop_slider').data('count'); 3419 if (slidesToShow > count) { 3420 slidesToShow = count; 3421 if (slidesToShow < 1) { 3422 slidesToShow = 1; 3423 } 3424 } 3425 3426 slider.slick({ 3427 cssEase: 'ease-out', 3428 dots: true, 3429 infinite: true, 3430 touchThreshold: 10, 3431 speed: 300, 3432 3433 prevArrow: '<a class="button the-icon slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big" aria-label="previous slide"></i></span></a>', 3434 nextArrow: '<a class="button the-icon slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big" aria-label="next slide"></i></span></a>', 3435 appendArrows: slider.siblings('.blog_slider_header').children('.slider_navigation'), 3436 3437 appendDots: slider.siblings('.slider_pager'), 3438 customPaging: pager, 3439 3440 rtl: rtl ? true : false, 3441 autoplay: mfn.slider.shop ? true : false, 3442 autoplaySpeed: mfn.slider.shop ? mfn.slider.shop : 5000, 3443 3444 slidesToShow: slickAutoResponsive(slider, slidesToShow), 3445 slidesToScroll: slickAutoResponsive(slider, slidesToShow) 3446 }); 3447 3448 // ON | debouncedresize 3449 3450 $(window).on('debouncedresize', function() { 3451 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, slidesToShow), false); 3452 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, slidesToShow), true); 3453 }); 3454 3455 }); 3456 } 3457 3458 // Slider | Blog 3459 3460 function mfnSliderBlog() { 3461 3462 var pager = function(el, i) { 3463 return '<a>' + i + '</a>'; 3464 }; 3465 3466 $('.blog_slider_ul').each(function() { 3467 3468 var slider = $(this); 3469 var slidesToShow = 4; 3470 3471 var count = slider.closest('.blog_slider').data('count'); 3472 var singlePostMode = slider.closest('.blog_slider').hasClass('single_post_mode'); 3473 3474 if (slidesToShow > count) { 3475 slidesToShow = count; 3476 if (slidesToShow < 1) { 3477 slidesToShow = 1; 3478 } 3479 } 3480 3481 if (singlePostMode) { 3482 slidesToShow = 1; 3483 } 3484 3485 slider.slick({ 3486 cssEase: 'ease-out', 3487 dots: true, 3488 infinite: true, 3489 touchThreshold: 10, 3490 speed: 300, 3491 3492 prevArrow: '<a class="button the-icon slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big" aria-label="previous slide"></i></span></a>', 3493 nextArrow: '<a class="button the-icon slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big" aria-label="next slide"></i></span></a>', 3494 appendArrows: slider.siblings('.blog_slider_header').children('.slider_navigation'), 3495 3496 appendDots: slider.siblings('.slider_pager'), 3497 customPaging: pager, 3498 3499 rtl: rtl ? true : false, 3500 autoplay: mfn.slider.blog ? true : false, 3501 autoplaySpeed: mfn.slider.blog ? mfn.slider.blog : 5000, 3502 3503 slidesToShow: slickAutoResponsive(slider, slidesToShow), 3504 slidesToScroll: slickAutoResponsive(slider, slidesToShow) 3505 }); 3506 3507 // On | debouncedresize 3508 3509 $(window).on('debouncedresize', function() { 3510 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, slidesToShow), false); 3511 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, slidesToShow), true); 3512 }); 3513 3514 }); 3515 } 3516 3517 // Slider | Clients 3518 3519 function mfnSliderClients() { 3520 $('.clients_slider_ul').each(function() { 3521 3522 var slider = $(this); 3523 3524 var clientsPerSlide = slider.closest('.clients_slider').attr('data-client-per-slide') ? parseInt(slider.closest('.clients_slider').attr('data-client-per-slide')) : 4; 3525 var navigationPosition = slider.closest('.clients_slider').attr('data-navigation-position') || false; 3526 var appendArrows = ( navigationPosition == 'content' ) ? slider : slider.siblings('.blog_slider_header').children('.slider_navigation'); 3527 var size = 400; 3528 3529 var calc = () => slickAutoResponsive(slider, clientsPerSlide, size - (clientsPerSlide * 40), true); 3530 3531 slider.slick({ 3532 cssEase: 'ease-out', 3533 dots: false, 3534 infinite: true, 3535 touchThreshold: 10, 3536 speed: 300, 3537 3538 prevArrow: '<a class="button the-icon slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big" aria-label="previous slide"></i></span></a>', 3539 nextArrow: '<a class="button the-icon slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big" aria-label="next slide"></i></span></a>', 3540 appendArrows: appendArrows, 3541 3542 rtl: rtl ? true : false, 3543 autoplay: mfn.slider.clients ? true : false, 3544 autoplaySpeed: mfn.slider.clients ? mfn.slider.clients : 5000, 3545 3546 slidesToShow: calc(), 3547 slidesToScroll: calc() 3548 }); 3549 3550 // ON | debouncedresize 3551 3552 $(window).on('debouncedresize', function() { 3553 slider.slick('slickSetOption', 'slidesToShow', calc(), false); 3554 slider.slick('slickSetOption', 'slidesToScroll', calc(), true); 3555 }); 3556 3557 }); 3558 } 3559 3560 // Slider | Portfolio 3561 3562 function sliderPortfolio() { 3563 3564 $('.portfolio_slider_ul').each(function() { 3565 3566 var slider = $(this); 3567 var size = 380; 3568 var scroll = 5; 3569 3570 if (slider.closest('.portfolio_slider').data('size')) { 3571 size = slider.closest('.portfolio_slider').data('size'); 3572 } 3573 3574 if (slider.closest('.portfolio_slider').data('size')) { 3575 scroll = slider.closest('.portfolio_slider').data('scroll'); 3576 } 3577 3578 slider.slick({ 3579 cssEase: 'ease-out', 3580 dots: false, 3581 infinite: true, 3582 touchThreshold: 10, 3583 speed: 300, 3584 3585 prevArrow: '<a class="slider_nav slider_prev themebg" href="#"><i class="icon-left-open-big" aria-label="previous slide"></i></a>', 3586 nextArrow: '<a class="slider_nav slider_next themebg" href="#"><i class="icon-right-open-big" aria-label="next slide"></i></a>', 3587 3588 rtl: rtl ? true : false, 3589 autoplay: mfn.slider.portfolio ? true : false, 3590 autoplaySpeed: mfn.slider.portfolio ? mfn.slider.portfolio : 5000, 3591 3592 slidesToShow: slickAutoResponsive(slider, 5, size), 3593 slidesToScroll: slickAutoResponsive(slider, scroll, size) 3594 }); 3595 3596 // ON | debouncedresize 3597 $(window).on('debouncedresize', function() { 3598 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, 5, size), false); 3599 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, scroll, size), true); 3600 }); 3601 3602 }); 3603 } 3604 3605 // header promo bar | Slider 3606 3607 function promoBarSlider() { 3608 $('.promo_bar_slider').each(function() { 3609 var speed = parseInt($(this).attr('data-speed')) * 1000; 3610 3611 var $slider = $(this); 3612 $slider.find( '.pbs_one' ).first().addClass('pbs-active'); 3613 $slider.addClass('mfn-initialized'); 3614 3615 function changeSlide() {
3616 var $current = $slider.find( '.pbs_one.pbs-active' ); 3617 var $next = $slider.find( '.pbs_one.pbs-active' ).next(); 3618 if( !$next.length ) $next = $slider.find( '.pbs_one' ).first(); 3619 3620 $current.addClass('pbs-active-ends'); 3621 3622 setTimeout(function() { 3623 $current.removeClass('pbs-active pbs-active-ends'); 3624 $next.addClass('pbs-active'); 3625 }, 300); 3626 3627 } 3628 3629 if( $slider.find( '.pbs_one' ).length > 1 ){ 3630 setInterval(changeSlide, speed); 3631 } 3632 3633 }); 3634 } 3635 3636 // Slider | Slider 3637 3638 function sliderSlider() { 3639 3640 var pager = function(el, i) { 3641 return '<a>' + i + '</a>'; 3642 }; 3643 3644 $('.content_slider_ul').each(function() { 3645 3646 var slider = $(this); 3647 var count = 1; 3648 var centerMode = false; 3649 3650 if (slider.closest('.content_slider').hasClass('carousel')) { 3651 count = slickAutoResponsive(slider); 3652 3653 $(window).on('debouncedresize', function() { 3654 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider), false); 3655 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider), true); 3656 }); 3657 } 3658 3659 if (slider.closest('.content_slider').hasClass('center')) { 3660 centerMode = true; 3661 } 3662 3663 slider.slick({ 3664 cssEase: 'cubic-bezier(.4,0,.2,1)', 3665 dots: true, 3666 infinite: true, 3667 touchThreshold: 10, 3668 speed: 300, 3669 3670 centerMode: centerMode, 3671 centerPadding: '20%', 3672 3673 prevArrow: '<a class="button the-icon slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big" aria-label="previous slide"></i></span></a>', 3674 nextArrow: '<a class="button the-icon slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big" aria-label="next slide"></i></span></a>', 3675 3676 adaptiveHeight: true, 3677 appendDots: slider.siblings('.slider_pager'), 3678 customPaging: pager, 3679 3680 rtl: rtl ? true : false, 3681 autoplay: mfn.slider.slider ? true : false, 3682 autoplaySpeed: mfn.slider.slider ? mfn.slider.slider : 5000, 3683 3684 slidesToShow: count, 3685 slidesToScroll: count 3686 }); 3687 3688 // Lightbox | disable on dragstart 3689 3690 var clickEvent = false; 3691 3692 slider.on('dragstart', '.slick-slide a[rel="lightbox"]', function(event) { 3693 if (lightboxAttr) { 3694 var events = $._data(this,'events'); 3695 if( events && Object.prototype.hasOwnProperty.call(events, 'click') ){ 3696 clickEvent = events.click[0]; 3697 $(this).addClass('off-click').off('click'); 3698 } 3699 } 3700 }); 3701 3702 // Lightbox | enable after change 3703 3704 slider.on('afterChange', function(event, slick, currentSlide, nextSlide) { 3705 if (lightboxAttr) { 3706 $('a.off-click[rel="lightbox"]', slider).removeClass('off-click').on('click', clickEvent); 3707 } 3708 }); 3709 3710 }); 3711 } 3712 3713 // Slider | Testimonials 3714 3715 function sliderTestimonials() { 3716 3717 var pager = function(el, i) { 3718 var img = $(el.$slides[i]).find('.single-photo-img').html(); 3719 return '<a>' + img + '</a>'; 3720 }; 3721 3722 $('.testimonials_slider_ul').each(function() { 3723 3724 var slider = $(this); 3725 3726 slider.slick({ 3727 cssEase: 'ease-out', 3728 dots: true, 3729 infinite: true, 3730 touchThreshold: 10, 3731 speed: 300, 3732 3733 prevArrow: '<a class="button the-icon slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big" aria-label="previous slide"></i></span></a>', 3734 nextArrow: '<a class="button the-icon slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big" aria-label="next slide"></i></span></a>', 3735 3736 adaptiveHeight: true, 3737 appendDots: slider.siblings('.slider_pager'), 3738 customPaging: pager, 3739 3740 rtl: rtl ? true : false, 3741 autoplay: mfn.slider.testimonials ? true : false, 3742 autoplaySpeed: mfn.slider.testimonials ? mfn.slider.testimonials : 5000, 3743 3744 slidesToShow: 1, 3745 slidesToScroll: 1 3746 }); 3747 3748 }); 3749 } 3750 3751 /** 3752 * GDPR 3753 */ 3754 3755 // GDPR | Close notice on click | BIND 3756 3757 $('.mfn-gdpr-button').on('click', function(){ 3758 var closeAnimation = $('.mfn-gdpr-button').attr('data-animation'); 3759 var barAligment = $('#mfn-gdpr').attr('data-aligment'); 3760 3761 switch(true){ 3762 case 'none' === closeAnimation: 3763 $('#mfn-gdpr').css('display', 'none'); 3764 break; 3765 case 'fade' === closeAnimation: 3766 $('#mfn-gdpr').fadeOut(300); 3767 break; 3768 case 'slide' === closeAnimation && 'top' === barAligment: 3769 $('#mfn-gdpr').slideUp(300); 3770 break; 3771 default: 3772 $('#mfn-gdpr').slideToggle(300); 3773 break; 3774 } 3775 3776 // wait for animation end, then remove clasa and set cookies 3777 setTimeout(function(){ 3778 $('#mfn-gdpr').removeClass('show'); 3779 gdpr_set_cookie(); 3780 }, 300); 3781 }); 3782 3783 // GDPR | Set the cookie 3784 3785 function gdpr_set_cookie(){ 3786 if(navigator.cookieEnabled) { 3787 var cookieDays = $('.mfn-gdpr-button').attr('data-cookiedays') || 365; 3788 var cookieDate = new Date(); 3789 var cookieText = ''; 3790 3791 cookieDate.setTime(cookieDate.getTime() + (cookieDays * 24 * 60 * 60 * 1000)); 3792 cookieText += "mfn-gdpr=1"; 3793 cookieText += "; expires=" + cookieDate.toUTCString() + ';'; 3794 cookieText += "; path=" + mfn.home_url + '/'; 3795 3796 document.cookie = cookieText; 3797 } 3798 } 3799 3800 // GDPR | Display, if cookie not accepted 3801 3802 function gdpr(){ 3803 if (document.cookie !== "") { 3804 var cookies = document.cookie.split(/; */); 3805 3806 for (var cookie of cookies) { 3807 var [ cookieName ] = cookie.split("="); 3808 3809 if (cookieName === 'mfn-gdpr') { 3810 return; // cookie exists 3811 } 3812 } 3813 } 3814 3815 $('#mfn-gdpr').addClass('show'); //cookie does NOT exist 3816 } 3817 3818 /* 3819 * Infinite scroll functionality 3820 */ 3821 3822 function infiniteScrollFunction(infiniteLoadContainer, infiniteLoadButton, scrollDirection){ 3823 3824 // for proper check, if we need to fetch posts again. 3825 var screenHeight = document.body.clientHeight; 3826 3827 if ( infiniteLoadContainer.attr('data-attr') === $(infiniteLoadButton).attr('href') ) { 3828 return; // it means, that maximum length of pages is crossed 3829 } else if (scrollDirection === 'down') { 3830 3831 // attach link for check, and click the load more button! 3832 infiniteLoadContainer.attr('data-attr', $(infiniteLoadButton).attr('href')); 3833 infiniteLoadButton.click(); 3834
3835 // prevention, when height did not change enought, load again 3836 setTimeout(function(){ 3837 var heightAfterLoadDifference = (document.body.clientHeight - screenHeight); 3838 3839 if( heightAfterLoadDifference < 249 ) { 3840 infiniteScrollFunction(infiniteLoadContainer, infiniteLoadButton, scrollDirection); 3841 } 3842 }, 500); 3843 3844 } 3845 } 3846 3847/* function infiniteScrollPortfolio(){ 3848 var infiniteLoadContainer = $('.mfn-infinite-load-button'); 3849 var infiniteLoadButton = $('.mfn-infinite-load-button a'); 3850 3851 $(infiniteLoadContainer).waypoint({ 3852 handler: function(direction) { 3853 infiniteScrollFunction(infiniteLoadContainer, infiniteLoadButton, direction); 3854 }, 3855 offset: function(){ 3856 //after each load, calc the offset of element to know when posts should be loaded 3857 var offsetPosition = - ( ($(this)[0].element.scrollHeight) - (window.innerHeight / 1.2) ); 3858 return offsetPosition; 3859 } 3860 }); 3861 3862 3863 } */ 3864 3865 /* 3866 * Table of Contents | toc 3867 */ 3868 3869 $('body').on('click', ".table_of_content .toggle", function(e){ 3870 3871 e.preventDefault(); 3872 3873 if( $('.table_of_content').hasClass('hide') ){ 3874 3875 $('.table_of_content').removeClass('hide'); 3876 3877 $('.table_of_content_wrapper').slideDown( { 3878 duration: 400, 3879 always: function(){ 3880 $('.table_of_content').removeClass('hide_on_start'); 3881 } 3882 }); 3883 3884 } else { 3885 3886 $('.table_of_content_wrapper').slideUp( { 3887 duration: 400 3888 }); 3889 3890 $('.table_of_content').addClass('hide'); 3891 3892 } 3893 3894 }); 3895 3896 function tableContentAttachId(){ 3897 const container = $('.table_of_content'); 3898 let tags; 3899 let anchorNumber = 0; 3900 let anchorDom = $('.table_of_content_wrapper').find('a'); 3901 3902 if(tags = container.attr('data-tags')){ 3903 tags = tags.split(/[ ,]+/).join(','); //remove spaces, add commas 3904 3905 // muffin builder, gutenberg, elementor 3906 let columns = $('.mfn-builder-content .column_column, .mfn-builder-content .column_heading, .mfn-builder-content .column_fancy_heading, .the_content_wrapper:not(.is-elementor), .elementor-widget:not(.elementor-widget-mfn_table_of_contents)'); 3907 3908 $(columns).each( ( index, element ) => { 3909 let headingsNoticed = $(element).find(tags); //look for headings 3910 3911 $(headingsNoticed).each( ( index, element ) => { 3912 3913 if( $(element).attr('id') ) { //replace toc_X with user assigned ID 3914 3915 const idSet = '#'+$(element).attr('id'); 3916 $(anchorDom[anchorNumber]).attr('href', idSet ); 3917 3918 }else{ 3919 3920 let id = $(anchorDom[anchorNumber]).attr('href'); 3921 $(element).attr('id', id.substr(1) ); 3922 3923 } 3924 3925 anchorNumber++; 3926 }) 3927 3928 }) 3929 3930 } 3931 } 3932 3933 /** 3934 * Off-canvas sidebar 3935 */ 3936 3937 var offCanvasSidebar = { 3938 init: function() { 3939 $(document).on('click', '.mfn-off-canvas-switcher', function(e) { 3940 e.preventDefault(); 3941 if( $('html').hasClass('mfn-ofcs-opened') ){ 3942 $('html').removeClass('mfn-ofcs-opened'); 3943 }else{ 3944 $('html').addClass('mfn-ofcs-opened'); 3945 } 3946 }); 3947 }, 3948 mobile: function() { 3949 if( $('.sidebar .widget-area').length && $('body').hasClass('ofcs-mobile') ){ 3950 3951 if( !$('.mfn-off-canvas-sidebar').length ){ 3952 $('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>'); 3953 } 3954 3955 if( $('body').hasClass('woocommerce-shop') && !$('.mfn-woo-filters-wrapper .mfn-off-canvas-switcher').length ){ 3956 $('.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>.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>'); 3957 } 3958 3959 var $ofcs = $('.mfn-off-canvas-sidebar .mfn-off-canvas-content-wrapper .mfn-off-canvas-content'); 3960 $ofcs.empty(); 3961 3962 $('.sidebar .widget-area').each(function() { 3963 //var $sdbr = $(this).clone(true); 3964 $ofcs.append( $(this) ); 3965 //$(this).hide(); 3966 }); 3967 3968 offCanvasSidebar.init(); 3969 3970 } 3971 } 3972 } 3973 3974 function alignHeights(){ 3975 var i = 0; 3976 if( !$('.mfn-align-heights').length ) return; 3977 $('.mfn-align-heights').each(function() { 3978 var max=0; 3979 var newclass = 'mfn-align-cont-'+i; 3980 $(this).addClass(newclass); 3981 $("<style type='text/css'> ."+newclass+" .mfn-align-me{ height: auto;} </style>").appendTo("body"); 3982 $("."+newclass+" .mfn-align-me").each(function() { 3983 if($(this).outerHeight() > max){max = $(this).outerHeight();} 3984 }); 3985 $("<style type='text/css'> ."+newclass+" .mfn-align-me{ height: "+max+"px;} </style>").appendTo("body"); 3986 i++; 3987 }); 3988 } 3989 3990 $(window).on('debouncedresize', alignHeights); 3991 3992 var headerMegamenu = { 3993 init: function() { 3994 3995 if( $('.mfn-megamenu-menu.mfn-mm-submenu-toggled li.menu-item-has-children').length ){ 3996 $('.mfn-megamenu-menu.mfn-mm-submenu-toggled li.menu-item-has-children > a').on('click', function(e) { 3997 let href = $(this).attr('href'); 3998 if( !$(this).parent('li').hasClass('mfn-li-childrens-show') ){ 3999 e.preventDefault(); 4000 e.stopPropagation(); 4001 $(this).siblings('ul').slideDown(300); 4002 $(this).parent('li').addClass('mfn-li-childrens-show'); 4003 }else if( href == '' || href == '#' ){ 4004 e.preventDefault(); 4005 e.stopPropagation(); 4006 $(this).siblings('ul').slideUp(300); 4007 $(this).parent('li').removeClass('mfn-li-childrens-show'); 4008 } 4009 }); 4010 } 4011 4012 /** 4013 * Submenu in mega menu 4014 * */ 4015 4016 if( $('.column_megamenu_menu ul.mfn-mm-menu-horizontal.mfn-mm-submenu-on-click li').length ){ 4017 $('.column_megamenu_menu ul.mfn-mm-menu-horizontal.mfn-mm-submenu-on-click li > a').on('click', function(e) { 4018 if( $(this).closest('li').hasClass('menu-item-has-children') && !$(this).closest('li').hasClass('mfn-li-hover') ){ 4019 e.preventDefault(); 4020 e.stopPropagation(); 4021 $(this).closest('li').addClass('mfn-li-hover'); 4022 } 4023 }); 4024 } 4025 4026 if( $('ul.mfn-menu-submenu-on-hover li.mfn-menu-item-has-megamenu, li.mfn-theme-options-menu.mfn-menu-item-has-megamenu').length ){ 4027 $('ul.mfn-menu-submenu-on-hover li.mfn-menu-item-has-megamenu, li.mfn-theme-options-menu.mfn-menu-item-has-megamenu').on('mouseenter', function() { 4028 if( $(this).find('.mfn-megamenu-full-width').length || $(this).find('.mfn-megamenu-grid').length ){ 4029 headerMegamenu.setLeft($(this)); 4030 } 4031 }); 4032 } 4033 4034 if( $('ul.mfn-menu-submenu-on-click li.mfn-menu-item-has-megamenu').length ){ 4035 4036 $('ul.mfn-menu-submenu-on-click li.mfn-menu-item-has-megamenu > a.mfn-menu-link').on('click', function(e) { 4037 let href = $(this).attr('href'); 4038 4039 if( $(this).closest('li').find('.mfn-megamenu-full-width').length || $(this).closest('li').find('.mfn-megamenu-grid').length ){ 4040 headerMegamenu.setLeft($(this).closest('li')); 4041 } 4042 4043 if( href == '' || href == '#' ){ 4044 e.preventDefault(); 4045 e.stopPropagation(); 4046 if( $(this).closest('li').hasClass('mfn-li-hover') ) { 4047 $(this).closest('li').removeClass('mfn-li-hover'); 4048 $(document).unbind('click', headerTemplate.bindUnclick); 4049 $('body').removeClass('mfn-content-gray mfn-content-blur mfn-content-overlay'); 4050 }else{ 4051 $(this).closest('li').addClass('mfn-li-hover'); 4052 $(document).bind('click', headerTemplate.bindUnclick); 4053 headerTemplate.animContentAddClass(); 4054 } 4055 }else if( !$(this).closest('li').hasClass('mfn-li-hover') ){ 4056 e.preventDefault(); 4057 e.stopPropagation(); 4058 $('.mfn-header-tmpl ul li.mfn-li-hover').removeClass('mfn-li-hover'); 4059 if( !$(this).closest('.mfn-megamenu-menu').length && !$(this).closest('li.mfn-li-hover').length ) { 4060 if( $('.mfn-megamenu-menu.mfn-mm-submenu-toggled li.menu-item-has-children.mfn-li-childrens-show').length ){ 4061 $('.mfn-megamenu-menu.mfn-mm-submenu-toggled li.menu-item-has-children.mfn-li-childrens-show ul').slideUp(); 4062 $('.mfn-megamenu-menu.mfn-mm-submenu-toggled li.menu-item-has-children.mfn-li-childrens-show').removeClass('mfn-li-childrens-show'); 4063 } 4064 } 4065 headerTemplate.animContentAddClass(); 4066 $(this).parent('li').addClass('mfn-li-hover'); 4067 $(document).bind('click', headerTemplate.bindUnclick); 4068 } 4069 4070 }); 4071 4072 } 4073 4074 },
4075 setLeft: function($li) { 4076 var $mm = $li.find('.mfn-menu-item-megamenu'); 4077 var left = $li.offset().left; 4078 $mm.css('width', $(window).width()+'px'); 4079 $mm.css('left', '-'+left+'px'); 4080 4081 //$(window).trigger('resize'); 4082 } 4083 } 4084 4085 var footerTemplate = { 4086 init: function() { 4087 if( $('body').hasClass('mfn-footer-stick') ){ 4088 footerTemplate.isSticky(); 4089 } 4090 if( $('body').hasClass('mfn-footer-sliding') || $('body').hasClass('mfn-footer-fixed') ){ 4091 footerTemplate.isSliding(); 4092 } 4093 return; 4094 }, 4095 isSticky: function() { 4096 var offsetTop = $('.mfn-footer-tmpl').offset().top + $('.mfn-footer-tmpl').outerHeight(); 4097 if( offsetTop < $(window).height() ){ 4098 $('.mfn-footer-tmpl').addClass('is-sticky'); 4099 }else{ 4100 $('.mfn-footer-tmpl').removeClass('is-sticky'); 4101 } 4102 }, 4103 isSliding: function() { 4104 var footer = $('.mfn-footer-tmpl').outerHeight(); 4105 $('#Content').css('margin-bottom', footer); 4106 } 4107 } 4108 4109 var headerTemplate = { 4110 hasSticky: false, 4111 isMobile: false, 4112 offsetScroll: 60, 4113 hasBodyOffset: false, 4114 height: 0, 4115 type: 'default', 4116 animContentOnHover: function() { 4117 4118 if( $('.mfn-header-tmpl.mfn-header-main .mfn-header-menu.mfn-header-mainmenu').hasClass('mfn-menu-submenu-on-hover') ){ 4119 $('.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', function() { 4120 headerTemplate.animContentAddClass(); 4121 }); 4122 } 4123 4124 $('.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() { 4125 $('body').removeClass('mfn-content-gray mfn-content-blur mfn-content-overlay'); 4126 }); 4127 4128 }, 4129 animContentAddClass: function() { 4130 if( $('.mfn-header-tmpl.mfn-header-main').hasClass('mfn-header-content-blur') ){ 4131 $('body').addClass('mfn-content-blur'); 4132 }else if( $('.mfn-header-tmpl.mfn-header-main').hasClass('mfn-header-content-gray') ){ 4133 $('body').addClass('mfn-content-gray'); 4134 }else if( $('.mfn-header-tmpl.mfn-header-main').hasClass('mfn-header-content-overlay') ){ 4135 $('body').addClass('mfn-content-overlay'); 4136 } 4137 }, 4138 openOnClick: function() { 4139 4140 // common 4141 $('.mfn-header-tmpl .mfn-header-menu.mfn-menu-submenu-on-click li.menu-item-has-children > a.mfn-menu-link').off().on('click', function(e) { 4142 let href = $(this).attr('href'); 4143 4144 if( $(this).closest('li').find('.mfn-megamenu-full-width').length || $(this).closest('li').find('.mfn-megamenu-grid').length ){ 4145 headerMegamenu.setLeft($(this).closest('li')); 4146 } 4147 4148 if( href == '' || href == '#' ){ 4149 e.preventDefault(); 4150 e.stopPropagation(); 4151 if( $(this).closest('li').hasClass('mfn-li-hover') ) { 4152 $(this).closest('li').removeClass('mfn-li-hover'); 4153 $(document).unbind('click', headerTemplate.bindUnclick); 4154 $('body').removeClass('mfn-content-gray mfn-content-blur mfn-content-overlay'); 4155 }else{ 4156 $(this).closest('li').addClass('mfn-li-hover'); 4157 $(document).bind('click', headerTemplate.bindUnclick); 4158 headerTemplate.animContentAddClass(); 4159 } 4160 }else if( !$(this).closest('li').hasClass('mfn-li-hover') ){ 4161 e.preventDefault(); 4162 e.stopPropagation(); 4163 //$('.mfn-header-tmpl ul li.mfn-li-hover').removeClass('mfn-li-hover'); 4164 headerTemplate.animContentAddClass(); 4165 $(this).parent('li').addClass('mfn-li-hover'); 4166 $(document).bind('click', headerTemplate.bindUnclick); 4167 } 4168 4169 }); 4170 4171 }, 4172 bindUnclick: function(e) { 4173 var $li = $('.mfn-header-tmpl ul li.mfn-li-hover'); 4174 if (!$li.is(e.target)) { 4175 $li.removeClass('mfn-li-hover'); 4176 $('body').removeClass('mfn-content-gray mfn-content-blur mfn-content-overlay'); 4177 $(document).unbind('click', headerTemplate.bindUnclick); 4178 } 4179 }, 4180 closeable: function() { 4181 // common 4182 $('.mfn-header-tmpl .close-closeable-section').on('click', function() { 4183 var $section = $(this).closest('.mcb-section');
4184 $section.addClass('closeable-hidden').slideUp(300, function() { 4185 headerTemplate.resetOffset(); 4186 headerTemplate.offset(); 4187 }); 4188 4189 if( typeof $section.attr('data-close-days') !== 'undefined' && $section.attr('data-close-days') != '0' ){ 4190 var days = $section.attr('data-close-days'); 4191 var uid = $section.attr('data-uid'); 4192 var date=new Date(); 4193 date.setTime(date.getTime()+(parseInt(days)*24*60*60*1000)); 4194 var expires="; expires="+date.toGMTString(); 4195 document.cookie="mfn_closed_section="+uid+expires+"; path=/" 4196 } 4197 4198 }); 4199 }, 4200 resetOffset: function() { 4201 if( headerTemplate.type != 'default' && headerTemplate.hasBodyOffset ){ 4202 $('#Wrapper').css({ 'padding-top': $('.mfn-header-tmpl').outerHeight() }); 4203 } 4204 }, 4205 offset: function() { 4206 if( headerTemplate.hasSticky && !headerTemplate.isMobile ) return; 4207 headerTemplate.offsetScroll = 0; 4208 var _screen = 'default'; 4209 if( $(window).width() < 767 ) _screen = 'header-mobile'; 4210 $('.mfn-header-tmpl .mfn-'+_screen+'-section.hide-on-scroll:not(.closeable-hidden)').each(function() { 4211 headerTemplate.offsetScroll += $(this).outerHeight(); 4212 }); 4213 4214 }, 4215 init: function() { 4216 headerTemplate.hasBodyOffset = false; 4217 4218 if( $(window).width() < 767 && $('.mfn-header-tmpl').hasClass('mfn-hasMobile') ){ 4219 headerTemplate.isMobile = true; 4220 headerTemplate.type = $('.mfn-header-tmpl').attr('data-mobile-type'); 4221 if( $('.mfn-header-tmpl').hasClass('mfn-mobile-header-body-offset') ) { 4222 headerTemplate.hasBodyOffset = true; 4223 }else{ 4224 headerTemplate.hasBodyOffset = false; 4225 } 4226 }else{ 4227 headerTemplate.isMobile = false; 4228 headerTemplate.type = $('.mfn-header-tmpl').attr('data-type'); 4229 if( $('.mfn-header-tmpl').hasClass('mfn-header-body-offset') ) { 4230 headerTemplate.hasBodyOffset = true; 4231 }else{ 4232 headerTemplate.hasBodyOffset = false; 4233 } 4234 } 4235 4236 // init submenu show on click 4237 if( $('.mfn-header-tmpl .mfn-menu-submenu-on-click').length ) { 4238 headerTemplate.openOnClick(); 4239 } 4240 4241 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') ){ 4242 headerTemplate.animContentOnHover(); 4243 } 4244 4245 // sticky header 4246 /*if( $('.mfn-header-tmpl .mfn-header-sticky-section').length ) { 4247 if( !headerTemplate.isMobile ){ 4248 headerTemplate.hasSticky = true; 4249 $('.mfn-header-tmpl').addClass('mfn-hasSticky'); 4250 }else{ 4251 headerTemplate.hasSticky = false; 4252 $('.mfn-header-tmpl').removeClass('mfn-hasSticky'); 4253 } 4254 }*/ 4255 4256 if( $('.mfn-header-tmpl').hasClass('mfn-hasSticky') ) { 4257 headerTemplate.hasSticky = true; 4258 }else{ 4259 headerTemplate.hasSticky = false; 4260 } 4261 4262 if( $('body style.tmp-mfn-header-template').length ) $('body style.tmp-mfn-header-template').remove(); 4263 4264 if( $('.mfn-header-tmpl .close-closeable-section').length ) headerTemplate.closeable(); 4265 4266 if( $('body').hasClass('mfn-header-scrolled') && !$('.mfn-builder-active').length ) $('body').removeClass('mfn-header-scrolled'); 4267 4268 headerTemplate.getHeight(); 4269 headerTemplate.offset(); 4270 4271 headerTemplate.scroll(); 4272 4273 if( $(window).scrollTop() > 10 ){ 4274 $(window).trigger('scroll'); 4275 } 4276 }, 4277 scroll: function() { 4278 4279 // relative header prevent skip with sticky 4280 if( $('.mfn-header-tmpl').hasClass('mfn-header-tmpl-default') && headerTemplate.hasSticky ) { 4281 $('body').append('<style class="tmp-mfn-header-template">html body.mfn-header-scrolled{padding-top: '+headerTemplate.height+'px;}</style>'); 4282 } 4283 4284 $(window).scroll(function() { 4285 var scrolled = $(this).scrollTop(); 4286 var scroll_offset = headerTemplate.offsetScroll; 4287 if( headerTemplate.hasSticky ) scroll_offset = headerTemplate.height; 4288 4289 if(scrolled > scroll_offset){ 4290 $('body').addClass('mfn-header-scrolled'); 4291 4292 if( $('.mfn-header-tmpl').hasClass('mfn-header-tmpl-fixed') && $('.mfn-header-tmpl .hide-on-scroll:not(.closeable-hidden)').length ){ 4293 if( headerTemplate.hasSticky ){ 4294 $('.mfn-header-tmpl').css({'top': 0}); 4295 }else{ 4296 $('.mfn-header-tmpl').css({'top': '-'+headerTemplate.offsetScroll+'px'}); 4297 } 4298 } 4299 4300 }else{ 4301 $('body').removeClass('mfn-header-scrolled'); 4302 4303 if( $('.mfn-header-tmpl').hasClass('mfn-header-tmpl-fixed') && $('.mfn-header-tmpl .hide-on-scroll:not(.closeable-hidden)').length ){ 4304 $('.mfn-header-tmpl').css({'top': '-'+scrolled+'px'}); 4305 } 4306 4307 } 4308 }); 4309 }, 4310 getHeight: function() { 4311 headerTemplate.height = $('.mfn-header-tmpl').outerHeight(); 4312 if( headerTemplate.type != 'default' && headerTemplate.hasBodyOffset ){ 4313 $('#Wrapper').css({ 'padding-top' : headerTemplate.height }); 4314 }else{ 4315 $('#Wrapper').removeAttr('style'); 4316 } 4317 $('.mfn-header-tmpl').removeAttr('style'); 4318 }, 4319 } 4320 4321 /** 4322 * Lazy Load images 4323 */ 4324 4325 document.addEventListener('DOMContentLoaded', () => { 4326 4327 const images = Array.from(document.querySelectorAll('img.mfn-lazy')); 4328 4329 if ('IntersectionObserver' in window) { 4330 const imageObserver = new IntersectionObserver((entries, observer) => {
4331 entries.forEach(entry => { 4332 if (entry.isIntersecting) { 4333 const image = entry.target; 4334 image.src = image.dataset.src; 4335 imageObserver.unobserve(image); 4336 window.dispatchEvent(new Event('resize')); 4337 } 4338 }); 4339 }); 4340 4341 images.forEach(img => imageObserver.observe(img)); 4342 } 4343 4344 }); 4345 4346})(jQuery);
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.