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