PageSourceSearch

https://www.pioneerwindowanddoor.com/wp-content/themes/betheme/js/scripts.js?ver=25.0.4

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