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