PageSourceSearch

https://tvzint.com.br/wp-content/themes/betheme/js/scripts.js?ver=26.5.0.4

js tvzint.com.br collected 2026-10-09 22:41:50 UTC 108,064 bytes, 4,180 lines download raw bytes

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