PageSourceSearch

https://learningmate.com/wp-content/themes/bb-theme/js/theme.js?ver=1.7.19.1

js learningmate.com collected 2026-09-24 09:33:11 UTC 43,585 bytes, 1,629 lines download raw bytes

1(function($){
2
3	/**
4	 * Helper class for frontend theme logic.
5	 *
6	 * @since 1.0
7	 * @class FLTheme
8	 */
9	FLTheme = {
10
11		/**
12		 * Initializes all frontend theme logic.
13		 *
14		 * @since 1.0
15		 * @method init
16		 */
17		init: function()
18		{
19			this._bind();
20		},
21
22		/**
23		 * Initializes and binds all frontend events.
24		 *
25		 * @since 1.0
26		 * @access private
27		 * @method _bind
28		 */
29		_bind: function()
30		{
31			var self = this;
32
33			// Nav Toggles
34			$('.navbar-toggle').on('click', this.navbarToggleClick);
35
36			// Top Nav Drop Downs
37			if($('.fl-page-bar-nav ul.sub-menu').length != 0) {
38				this._setupDropDowns();
39				this._enableTopNavDropDowns();
40			}
41
42			// Page Nav Drop downs
43			if($('.fl-page-nav ul.sub-menu').length != 0) {
44				$(window).on('resize.fl-page-nav-sub-menu', $.throttle(500, this._enablePageNavDropDowns));
45				this._setupDropDowns();
46				this._enablePageNavDropDowns();
47			}
48
49			// Current menu item initializes or click
50			if($('.fl-page-nav ul.menu').length != 0) {
51				$('.fl-page-nav ul.menu').find('.menu-item').on('click', '> a[href*="#"]:not([href="#"])', this._setupCurrentNavItem);
52				this._setupCurrentNavItem();
53			}
54
55			// Nav Search
56			if($('.fl-page-nav-search').length != 0) {
57				$('.fl-page-nav-search a.fa-search').on('click', this._toggleNavSearch);
58			}
59
60			// Nav vertical
61			if($('.fl-nav-vertical').length != 0) {
62				$(window).on('resize', $.throttle(500, this._navVertical));
63				this._navVertical();
64			}
65
66			// Nav vertical right & boxed layout
67			if($('.fl-fixed-width.fl-nav-vertical-right').length != 0) {
68				$(window).on('resize', $.throttle(500, this._updateVerticalRightPos));
69				this._updateVerticalRightPos();
70			}
71
72			// Centered inline logo
73			if($('.fl-page-nav-centered-inline-logo').length != 0) {
74				$(window).on('resize', $.throttle(500, this._centeredInlineLogo));
75				this._centeredInlineLogo();
76			}
77
78			// Nav Left
79			if($('body.fl-nav-left').length != 0) {
80				$(window).on('resize', $.throttle(500, this._navLeft));
81				this._navLeft();
82			}
83
84			// Shrink Header
85			if( ($('body.fl-shrink').length != 0) && !($('html.fl-builder-edit').length != 0) ) {
86				$(window).on('resize', $.throttle(500, this._shrinkHeaderEnable));
87				this._shrinkHeaderInit();
88				this._shrinkHeaderEnable();
89			}
90
91			// Fixed Header (Fade In)
92			if($('.fl-page-header-fixed').length != 0) {
93				$(window).on('resize.fl-page-header-fixed', $.throttle(500, this._enableFixedHeader));
94				this._enableFixedHeader();
95			}
96
97			// Fixed Header (Fixed)
98			if( ($('body.fl-fixed-header').length != 0) && !($('html.fl-builder-edit').length != 0) ) {
99				$(window).on('resize', $.throttle(500, this._fixedHeader));
100				this._fixedHeader();
101			}
102
103			// Hide Header Until Scroll
104			if( ($('body.fl-scroll-header').length != 0) && !($('html.fl-builder-edit').length != 0) ) {
105				$(window).on('resize', $.throttle(500, this._scrollHeader));
106				this._scrollHeader();
107			}
108
109			// Mega Menu (Primary Nav)
110			if($('.fl-page-header-primary').find( 'li.mega-menu' ).length != 0) {
111				$(window).on('resize', $.throttle(500, this._megaMenu));
112				this._megaMenu();
113			}
114
115			// Mega Menu (Fixed)
116			if($('.fl-page-header-fixed').length != 0) {
117				$(window).on('scroll.fl-mega-menu-on-scroll', $.throttle(500, this._megaMenuOnScroll));
118				$(window).on('resize.fl-mega-menu-on-scroll', $.throttle(500, this._megaMenuOnScroll));
119			}
120
121			// Headers not be fixed when the builder is active
122			if($('html.fl-builder-edit').length != 0) {
123				this._fixedHeadersWhenBuilderActive();
124			}
125
126			// Responsive Nav Layout
127			if ( $( 'body.fl-nav-mobile-offcanvas' ).length != 0 && ! $( 'html.fl-builder-edit' ).length != 0 ) {
128				$(window).on('resize', $.throttle(500, this._setupMobileNavLayout));
129				this._setupMobileNavLayout();
130				this._toggleMobileNavLayout();
131			}
132
133			// Close Dropdown or Flyout Menu
134			$( 'body' ).on( 'click', this.closeMenu );
135
136			// Close Dropdown or Flyout Menu when tabbing out from the last menu item.
137			$( '.fl-theme-menu > li:last-child' ).on( 'focusout', function (e) {
138				if ( undefined === $(e.relatedTarget)[0] || 'nav-link' !== $(e.relatedTarget)[0].className) {
139					self.closeMenu( e );
140				}
141			});
142
143			// Footer parallax effect
144			if($('.fl-full-width.fl-footer-effect').length != 0) {
145				$(window).on('resize', $.throttle(500, this._footerEffect));
146				this._footerEffect();
147			}
148
149			// Go to Top
150			if($('body.fl-scroll-to-top').length != 0) {
151				this._toTop();
152			}
153
154			// Lightbox
155			if(typeof $('body').magnificPopup != 'undefined') {
156				this._enableLightbox();
157			}
158
159			// FitVids
160			if(typeof $.fn.fitVids != 'undefined' && !$('body').hasClass('fl-builder')) {
161				this._enableFitVids();
162			}
163			FLTheme._navBackiosFix();
164
165			// Smooth scrolling.
166			this._initSmoothScroll()
167		},
168
169		/**
170		 * Checks to see if the current device is mobile.
171		 *
172		 * @since 1.5.1
173		 * @access private
174		 * @method _isMobile
175		 * @return {Boolean}
176		 */
177		_isMobile: function()
178		{
179			if ( ( 'ontouchstart' in window ) || ( navigator.maxTouchPoints > 0 ) || ( navigator.msMaxTouchPoints > 0 ) ) {
180				return true;
181			}
182
183			return /Mobile|Android|Silk\/|Kindle|BlackBerry|Opera Mini|Opera Mobi|webOS/i.test( navigator.userAgent );
184		},
185
186		/**
187		 * Initializes retina images.
188		 *
189		 * @since 1.0
190		 * @access private
191		 * @method _initRetinaImages
192		 */
193		_initRetinaImages: function()
194		{
195			var pixelRatio = !!window.devicePixelRatio ? window.devicePixelRatio : 1;
196
197			if ( pixelRatio > 1 ) {
198				$( 'img[data-retina]' ).each( FLTheme._convertImageToRetina );
199			}
200		},
201
202		/**
203		 * Converts an image to retina.
204		 *
205		 * @since 1.0
206		 * @access private
207		 * @method _convertImageToRetina
208		 */
209		_convertImageToRetina: function()
210		{
211			var image       = $( this ),
212				tmpImage    = new Image(),
213				src         = image.attr( 'src' ),
214				retinaSrc   = image.data( 'retina' )
215
216			// check for cloudflare
217			if( typeof src == 'undefined') {
218				src = image.data( 'cfsrc' )
219			}
220
221			// still no src, bail.
222			if( typeof src == 'undefined') {
223				return false;
224			}
225
226			var type = src.split('.').pop();
227
228			if ( '' != retinaSrc  ) {
229
230				tmpImage.onload = function() {
231					var width = tmpImage.width,
232						height = tmpImage.height;
233
234					if ( 'svg' == type ) {
235						width = image.width();
236						height = image.height();
237					}
238
239				//image.css( 'max-height', height );
240					image.width( width );
241					image.attr( 'src', retinaSrc );
242				};
243
244				tmpImage.src = src;
245			}
246		},
247
248		/**
249		 * Mobile Header Logo.
250		 *
251		 * @since 1.7
252		 * @access private
253		 * @method _initMobileHeaderLogo
254		 */
255		_initMobileHeaderLogo: function()
256		{
257			this._enableMobileLogo();
258			$( window ).on( 'resize', $.proxy( this._enableMobileLogo, this ) );
259		},
260
261		/**
262		 * Enable Mobile Logo.
263		 *
264		 * @since 1.7
265		 * @access private
266		 * @method _enableMobileLogo
267		 */
268		_enableMobileLogo: function()
269		{
270			var win       = $( window ),
271				logoWrap  = $( '.fl-page-header-logo' ),
272				logos     = logoWrap.find( 'img[data-mobile]' ),
273				image     = null,
274				mobileSrc = null,
275				tmpImage  = null;
276
277			if ( 0 === logos.length ) {
278				return;
279			}
280
281			$( logos ).each( function(){
282				tmpImage  = new Image();
283				image     = $( this );
284				src       = image.attr( 'src' );
285				width     = image.data( 'width' );
286				height    = image.data( 'height' );
287				mobileSrc = image.data( 'mobile' );
288				mobileWidth = image.data( 'mobile-width' );
289				mobileHeight = image.data( 'mobile-height' )
290
291				image.attr( 'src', '' );
292				image.attr( 'data-src', src );
293
294				if ( win.width() < window.themeopts.mobile_breakpoint ) {
295
296					if ( '' != mobileSrc ) {
297						tmpImage.onload = function() {
298							image.attr( 'src', mobileSrc );
299							image.attr( 'width', mobileWidth );
300							image.attr( 'height', mobileHeight );
301							image.css( 'width', '' );
302						};
303						tmpImage.src = src;
304						image.show();
305					}
306				}
307				else {
308					if ( 'undefined' !== typeof image.data('src') ) {
309						image.attr( 'src', image.data('src') );
310						image.attr( 'width', width );
311						image.attr( 'height', height );
312						image.css( 'width', width );
313					}
314				}
315			});
316		},
317
318		/**
319		 * Toggles a collapsed navbar when the toggle button is
320		 * clicked and the current framework is the bootstrap base.
321		 *
322		 * @since 1.7
323		 * @param {Object} e
324		 */
325		navbarToggleClick: function( e ) {
326			var menuType = $('body').hasClass('fl-nav-mobile-offcanvas') ? 'flyout' : 'dropdown';
327
328			if ( 'dropdown' === menuType ) {
329				var	navBar = $(e.target).closest('.fl-page-nav'),
330					targetPanel = navBar.find('.fl-page-nav-collapse');
331
332				targetPanel.toggleClass('collapse');
333				targetPanel.toggleClass('in');
334
335			} else if ( 'flyout' === menuType ) {
336
337				$( '.fl-page' ).toggleClass( 'fl-nav-offcanvas-active' );
338
339			}
340
341			e.stopPropagation();
342		},
343
344		/**
345		 * Closes Dropdown or Flyout Menu when clicked anywhere on the page.
346		 *
347		 * @since 1.7.9
348		 * @param {Object} e
349		 */
350		closeMenu: function (e) {
351			var menuType = $( 'body' ).hasClass( 'fl-nav-mobile-offcanvas' ) ? 'flyout' : 'dropdown',
352				isDropdownMenuActive = $( '.fl-page-nav-collapse' ).hasClass( 'in' ),
353				isFlyoutMenuActive = $( '.fl-page' ).hasClass( 'fl-nav-offcanvas-active' ),
354				isMaxMegaMenu = $( e.target ).is( '.mega-toggle-animated-inner, .mega-menu-toggle-animated-block, .mega-toggle-animated-box, .mega-toggle-blocks-right' ),
355				pageNav;
356
357			if ( undefined === e || undefined === e.target || isMaxMegaMenu ) {
358				return;
359			}
360
361			if ( 'dropdown' === menuType && isDropdownMenuActive ) {
362				pageNav = $( '.navbar-collapse.in' ).closest( '.fl-page-nav' );
363				pageNav.find( '.navbar-toggle' ).trigger( 'click' );
364			} else if ( 'flyout' === menuType && isFlyoutMenuActive) {
365				$( '.fl-offcanvas-close' ).trigger( 'click' );
366			}
367		},
368
369		/**
370		 * Initializes drop down nav logic.
371		 *
372		 * @since 1.0
373		 * @access private
374		 * @method _setupDropDowns
375		 */
376		_setupDropDowns: function()
377		{
378			$('ul.sub-menu').each(function(){
379				$( this ).closest( 'li' ).find('a').first().attr( 'aria-haspopup', 'true' );
380			});
381		},
382
383		/**
384		 * Initializes drop down menu logic for top bar navs.
385		 *
386		 * @since 1.0
387		 * @access private
388		 * @method _enableTopNavDropDowns
389		 */
390		_enableTopNavDropDowns: function()
391		{
392			var nav        = $('.fl-page-bar-nav'),
393				navItems   = nav.find(' > li'),
394				subToggles = nav.find('> li').has('> ul.sub-menu').find('.fl-submenu-toggle-icon');
395
396			if ( FLTheme._isMobile() ) {
397				if( false !== /iPhone|iPad/i.test( navigator.userAgent ) ) {
398					navItems.hover(FLTheme._navItemMouseover, FLTheme._navItemMouseout);
399				}
400				else {
401					navItems.hover(function(){}, FLTheme._navItemMouseout);
402					subToggles.on('click', FLTheme._navSubMenuToggleClick);
403				}
404			}
405			else {
406				navItems.hover(FLTheme._navItemMouseover, FLTheme._navItemMouseout);
407			}
408		},
409
410		/**
411		 * Fixes an ios quirk, if we have a dropdown menu and a user clicks 'back'
412		 * the menu will stay open, ios does not reparse js when you click back.
413		 * This method detects that back has been clicked by looking for event.persisted
414		 *
415		 * @since 1.6.2
416		 * @method _navBackiosFix
417		 */
418		_navBackiosFix: function() {
419			ipad = (navigator.userAgent.match('iPhone|iPad') !== null && $('.menu-item-has-children').length > 0) ? true : false;
420			if( false !== ipad ) {
421				window.onpageshow = function(event) {
422					if (event.persisted) {
423						window.location.reload()
424					}
425				}
426			}
427		},
428
429		/**
430		 * Initializes builder smooth scrolling.
431		 *
432		 * @since 1.7.6
433		 * @return void
434		 */
435		_initSmoothScroll: function() {
436			// Bail if builder doesn't exist.
437			if ('undefined' === typeof FLBuilderLayout) {
438				return;
439			}
440
441			// if scroll is disabled globally via filter do not scroll.
442			if ('undefined' !== typeof window.themeopts.smooth && 'disabled' === window.themeopts.smooth) {
443				return;
444			}
445			var targetId = location.hash;
446			targetId     = targetId.replace( /(:|\!|\.|\[|\]|,|=|@|\/)/g, "\\$1" );
447			if (targetId && $( targetId ).length) {
448				setTimeout(function() {
449					window.scrollTo(0, 0);
450					FLBuilderLayout._scrollToElement( $(targetId) );
451				}, 1);
452			}
453		},
454
455		/**
456		 * Initializes drop down menu logic for the main nav for primary and fixed header.
457		 *
458		 * @since 1.0
459		 * @access private
460		 * @method _enablePageNavDropDowns
461		 */
462		_enablePageNavDropDowns: function()
463		{
464			var pageNav	   = $('.fl-page-header');
465
466			pageNav.each( FLTheme._enablePageNavDropDown );
467		},
468
469		/**
470		 * Callback logic for each main header nav dropdown
471		 *
472		 * @since 1.6
473		 * @access private
474		 * @method _enablePageNavDropDown
475		 */
476		_enablePageNavDropDown: function()
477		{
478			var pageNav	   = $(this),
479				nav        = pageNav.find('.fl-page-nav .fl-page-nav-collapse'),
480				navItems   = nav.find('ul li'),
481				subToggles = nav.find('li').has('> ul.sub-menu').find('> a'),
482				toggleIcon = nav.find('li').has('> ul.sub-menu').find('.fl-submenu-toggle-icon'),
483				subMenus   = nav.find('> ul > li').has('ul.sub-menu');
484
485			if( $( '.fl-page-nav .navbar-toggle' ).is( ':visible' ) ) {
486				navItems.off('mouseenter mouseleave');
487
488				// Toggle submenu
489				if ( $( 'body' ).hasClass( 'fl-submenu-toggle' ) ) {
490					subMenus = nav.find('> ul li').has('ul.sub-menu');
491				}
492				subMenus.find('> a').off().on('click', FLTheme._navItemClickMobile);
493				subMenus.find('.fl-submenu-toggle-icon').off().on('click', FLTheme._navItemClickMobile);
494
495				nav.find('.menu').on('click', '.menu-item > a[href*="#"]', FLTheme._toggleForMobile);
496				subToggles.off('click', FLTheme._navSubMenuToggleClick);
497			}
498			else {
499				nav.find('a').off('click', FLTheme._navItemClickMobile);
500				nav.find('a').off('click', FLTheme._toggleForMobile);
501				nav.find('.fl-submenu-toggle-icon').off('click', FLTheme._navItemClickMobile);
502				nav.removeClass('in').addClass('collapse');
503				navItems.removeClass('fl-mobile-sub-menu-open');
504				navItems.find('a').width(0).width('auto');
505
506				if ( FLTheme._isMobile() ) {
507					navItems.hover(function(){}, FLTheme._navItemMouseout);
508					subToggles.on('click', FLTheme._navSubMenuToggleClick);
509				}
510				else {
511					navItems.keydown( function(e){
512						if ( 9 === e.keyCode ) {
513							el = $(this)
514							focused = el.find(':focus')
515							if( focused.parent().is(':last-child') ) {
516								sub  = focused.parent().find('ul.sub-menu').first()
517								mega = focused.parent().parent().parent().parent().parent().hasClass('mega-menu')
518								mega_last = focused.parent().parent().parent().is(':last-child' )
519
520								if ( sub.length > 0 ) {
521									sub.trigger('mouseenter')
522								} else {
523									if ( ! mega || mega_last ) {
524										el.trigger('mouseleave')
525									}
526								}
527							}
528							parent = focused.closest('ul.sub-menu').parent()
529							if ( ! parent.hasClass('fl-sub-menu-open') ) {
530								focused.trigger('mouseenter')
531							}
532						}
533					} );
534					navItems.hover(FLTheme._navItemMouseover, FLTheme._navItemMouseout);
535				}
536			}
537		},
538
539		/**
540		 * Callback for when an item in a nav is clicked on mobile.
541		 *
542		 * @since 1.0
543		 * @access private
544		 * @method _navItemClickMobile
545		 * @param {Object} e The event object.
546		 */
547		_navItemClickMobile: function(e)
548		{
549			var nav     = $(this).closest('.fl-page-nav-collapse'),
550				parent  = $(this).closest('li'),
551				href    = $(this).attr('href'),
552				subMenu = parent.find( 'ul.sub-menu' ),
553				toggle  = $(e.target).hasClass('fl-submenu-toggle-icon'),
554				subChildren = null;
555
556			if( href && '#' !== href ) {
557				var targetId = href.split('#')[1];
558				if ( $('body').find('#'+  targetId).length > 0 && parent.hasClass( 'fl-mobile-sub-menu-open' ) ) {
559					el = $(this).parent().closest('nav').find( '.navbar-toggle')
560					el.trigger('click');
561					if ( 'undefined' !== typeof FLBuilderLayout && ( 'undefined' === typeof window.themeopts.smooth && 'disabled' !== window.themeopts.smooth ) ) {
562						setTimeout(function() {
563							window.scrollTo(0, 0);
564							FLBuilderLayout._scrollToElement( $('#'+  targetId) );
565						}, 1);
566					}
567				}
568			}
569
570			if( ( '#' == href || toggle ) && parent.hasClass( 'fl-mobile-sub-menu-open' ) ) {
571				e.preventDefault();
572				parent.removeClass('fl-mobile-sub-menu-open');
573				subMenu.hide();
574			}
575			else if(!parent.hasClass('fl-mobile-sub-menu-open')) {
576
577				e.preventDefault();
578				parent.addClass('fl-mobile-sub-menu-open');
579
580				if ( toggle && 0 === $('.fl-submenu-toggle').length ) {
581					subChildren = subMenu.find( 'li.menu-item-has-children' );
582					subChildren.addClass('fl-mobile-sub-menu-open');
583				}
584
585				subMenu.fadeIn(200);
586			}
587
588			if ( $( '.fl-nav-collapse-menu' ).length != 0 ) {
589				nav.find( 'li.fl-mobile-sub-menu-open' )
590					.not( $(this).parents( '.fl-mobile-sub-menu-open' ) )
591					.not( subChildren )
592					.removeClass( 'fl-mobile-sub-menu-open' )
593					.find( 'ul.sub-menu' ).hide();
594			}
595
596			e.stopPropagation();
597		},
598
599		/**
600		 * Setup and callback for nav item link that exists on a page.
601		 *
602		 * @since 1.5.3
603		 * @access private
604		 * @method _setupCurrentNavItem
605		 * @param {Object|Null} e The event object.
606		 */
607		_setupCurrentNavItem: function(e)
608		{
609			var nav 		= $('.fl-page-nav .navbar-nav'),
610				targetId 	= typeof e !== 'undefined' ? $(e.target).prop('hash') : window.location.hash,
611				targetId  = targetId.replace( /(:|\!|\.|\[|\]|,|=|@|\/)/g, "\\$1" ),
612				currentLink = targetId.length ? nav.find('a[href*=\\' + targetId + ']:not([href=\\#])') : null,
613				closeButton = nav.closest('.fl-page-nav').find('.fl-offcanvas-close');
614
615			if ( currentLink != null && $('body').find(targetId).length > 0 ) {
616				$( '.current-menu-item' ).removeClass( 'current-menu-item' );
617				currentLink.parent().addClass('current-menu-item');
618
619				if ( closeButton ) {
620					closeButton.trigger( 'click' );
621				}
622			}
623		},
624
625
626		/**
627		 * Callback for when the mouse leaves an item
628		 * in a nav at desktop sizes.
629		 *
630		 * @since 1.0
631		 * @access private
632		 * @method _navItemMouseover
633		 */
634		_navItemMouseover: function()
635		{
636			if($(this).find('ul.sub-menu').length === 0) {
637				return;
638			}
639
640			var li              = $(this),
641				parent          = li.parent(),
642				subMenu         = li.find('ul.sub-menu'),
643				subMenuWidth    = subMenu.width(),
644				subMenuPos      = 0,
645				winWidth        = $(window).width(),
646				spacerPos       = 0,
647				subMenuTopPos   = 0;
648
649			if(li.closest('.fl-sub-menu-right').length !== 0) {
650				li.addClass('fl-sub-menu-right');
651			}
652			else if($('body').hasClass('rtl')) {
653
654				subMenuPos = parent.is('ul.sub-menu') ?
655							 parent.offset().left - subMenuWidth:
656							 li.offset().left - subMenuWidth;
657
658				if(subMenuPos <= 0) {
659					li.addClass('fl-sub-menu-right');
660				}
661			}
662			else {
663
664				subMenuPos = parent.is('ul.sub-menu') ?
665							 parent.offset().left + (subMenuWidth * 2) :
666							 li.offset().left + subMenuWidth;
667
668				if(subMenuPos > winWidth) {
669					li.addClass('fl-sub-menu-right');
670				}
671			}
672
673			li.addClass('fl-sub-menu-open');
674
675			if ( ! li.hasClass('hide-heading') ) {
676				subMenu.hide();
677				subMenu.stop().fadeIn(200);
678			}
679
680			FLTheme._hideNavSearch();
681
682			// Mega menu hover fix
683			if ( li.closest( '.fl-page-nav-collapse' ).length !== 0 && li.hasClass( 'mega-menu' ) ) {
684
685				if ( li.find( '.mega-menu-spacer' ).length > 0 ) {
686					return;
687				}
688
689				subMenu.first().before( '<div class="mega-menu-spacer"></div>' );
690				spacerPos = li.find( '.mega-menu-spacer' ).offset().top;
691				subMenuTopPos = subMenu.first().offset().top;
692				li.find( '.mega-menu-spacer' ).css('padding-top', Math.floor( parseInt(subMenuTopPos - spacerPos) ) + 'px' );
693			}
694		},
695
696		/**
697		 * Callback for when the mouse leaves an item
698		 * in a nav at desktop sizes.
699		 *
700		 * @since 1.0
701		 * @access private
702		 * @method _navItemMouseout
703		 */
704		_navItemMouseout: function()
705		{
706			var li      = $(this),
707				subMenu = li.find('ul.sub-menu');
708
709
710			if ( ! li.hasClass('hide-heading') ) {
711				subMenu.stop().fadeOut({
712					duration: 200,
713					done: FLTheme._navItemMouseoutComplete
714				});
715			}
716			else {
717				FLTheme._navItemMouseoutComplete();
718			}
719		},
720
721		/**
722		 * Callback for when the mouse finishes leaving an item
723		 * in a nav at desktop sizes.
724		 *
725		 * @since 1.0
726		 * @access private
727		 * @method _navItemMouseoutComplete
728		 */
729		_navItemMouseoutComplete: function()
730		{
731			var li = $(this).parent();
732
733			li.removeClass('fl-sub-menu-open');
734			li.removeClass('fl-sub-menu-right');
735
736			if ( li.find( '.mega-menu-spacer' ).length > 0 ) {
737				li.find( '.mega-menu-spacer' ).remove();
738			}
739
740			$(this).show();
741		},
742
743		/**
744		 * Callback for when a submenu toggle is clicked on mobile.
745		 *
746		 * @since 1.5.1
747		 * @access private
748		 * @method _navSubToggleClick
749		 * @param {Object} e The event object.
750		 */
751		_navSubMenuToggleClick: function( e )
752		{
753			var li = $( this ).closest( 'li' ).eq( 0 );
754
755			if ( ! li.hasClass( 'fl-sub-menu-open' ) ) {
756				FLTheme._navItemMouseover.apply( li[0] );
757
758				e.preventDefault();
759			}
760		},
761
762		/**
763		 * Logic for the menu item  when clicked on mobile.
764		 *
765		 * @since  1.5.3
766		 * @return void
767		 */
768		 _toggleForMobile: function( e ){
769 			var nav 	= $('.fl-page-nav .fl-page-nav-collapse'),
770 				href 	= $(this).attr('href'),
771				hasSubmenu = $(this).closest('li').hasClass( 'menu-item-has-children' );
772
773 			if ( href !== '#' ) {
774				var targetId = href.split('#')[1];
775
776				if ( $('body').find('#'+  targetId).length > 0 && !hasSubmenu ) {
777 					/**
778 					 * Make sure bootstrap collapse is available before using it.
779 					 */
780 					if ( ! $.isFunction(nav.collapse) ) {
781 						el = $(this).parent().closest('nav').find( '.navbar-toggle')
782 						el.trigger('click')
783 					} else {
784 						nav.collapse('hide');
785 					}
786 				}
787 			}
788 		},
789
790		/**
791		 * Shows or hides the nav search form.
792		 *
793		 * @since 1.0
794		 * @access private
795		 * @method _toggleNavSearch
796		 */
797		_toggleNavSearch: function(e)
798		{
799			var form = $('.fl-page-nav-search form');
800
801			e.preventDefault();
802
803			if(form.is(':visible')) {
804				form.stop().fadeOut(200);
805			}
806			else {
807				form.stop().fadeIn(200);
808				$('body').on('click.fl-page-nav-search', FLTheme._hideNavSearch);
809				$('.fl-page-nav-search .fl-search-input').focus();
810			}
811		},
812
813		/**
814		 * Hides the nav search form.
815		 *
816		 * @since 1.0
817		 * @access private
818		 * @method _hideNavSearch
819		 * @param {Object} e (Optional) An event object.
820		 */
821		_hideNavSearch: function(e)
822		{
823			var form = $('.fl-page-nav-search form');
824
825			if(e !== undefined) {
826				if($(e.target).closest('.fl-page-nav-search').length > 0) {
827					return;
828				}
829			}
830
831			form.stop().fadeOut(200);
832
833			$('body').off('click.fl-page-nav-search');
834		},
835
836		/**
837		 * Nav Vertical
838		 *
839		 * @since 1.5
840		 * @access private
841		 * @method _navVertical
842		 */
843		_navVertical: function()
844		{
845			var win = $(window);
846
847
848			if(win.width() >= window.themeopts.medium_breakpoint && $('.fl-page-header-primary').hasClass('fl-page-nav-toggle-visible-always')){
849				$('body').toggleClass('fl-nav-vertical');
850
851				if( $('body').hasClass('fl-nav-vertical-left') ) {
852					$('body').toggleClass('fl-nav-vertical-left');
853				}
854
855				if( $('body').hasClass('fl-nav-vertical-right') ) {
856					$('body').toggleClass('fl-nav-vertical-right');
857				}
858			}
859		},
860
861		/**
862		 * Right position fix for right navigation on boxed layout
863		 *
864		 * @since 1.5
865		 * @access private
866		 * @method _updateVerticalRightPos
867		 */
868		_updateVerticalRightPos: function()
869		{
870			var win             = $(window).width(),
871				flpage          = $('.fl-page').width(),
872				vericalRightPos = ( (win - flpage) / 2 );
873
874			$('.fl-page-header-vertical').css('right', vericalRightPos);
875		},
876
877		/**
878		 * Nav Left
879		 *
880		 * @since 1.5
881		 * @access private
882		 * @method _navLeft
883		 */
884		_navLeft: function()
885		{
886			var win = $(window);
887
888			if(win.width() < window.themeopts.medium_breakpoint || $('.fl-page-header-primary').hasClass('fl-page-nav-toggle-visible-always')) {
889				$('.fl-page-header-primary .fl-page-logo-wrap').insertBefore('.fl-page-header-primary .fl-page-nav-col');
890			}
891			if(win.width() >= window.themeopts.medium_breakpoint && !$('.fl-page-header-primary').hasClass('fl-page-nav-toggle-visible-always')) {
892				$('.fl-page-header-primary .fl-page-nav-col').insertBefore('.fl-page-header-primary .fl-page-logo-wrap');
893			}
894
895			if($('.fl-page-header-fixed').length != 0 && ! $('.fl-page-header-fixed').hasClass('fl-page-nav-toggle-visible-always') ) {
896				$('.fl-page-header-fixed .fl-page-fixed-nav-wrap').insertBefore('.fl-page-header-fixed .fl-page-logo-wrap');
897			}
898		},
899
900		/**
901		 * Initialize header shrinking.
902		 *
903		 * @since 1.5.2
904		 * @access private
905		 * @method _shrinkHeaderInit
906		 */
907		_shrinkHeaderInit: function()
908		{
909			var distanceY = $(window).scrollTop(),
910				shrinkOn  = 250,
911				header    = $( '.fl-page-header' );
912
913			$( 'body' ).addClass( 'fl-shrink-header-enabled' );
914
915			if ('scrollRestoration' in history) {
916				history.scrollRestoration = 'manual';
917			}
918
919			$('.fl-page-header-logo').imagesLoaded(function(){
920				var logo       = $( '.fl-logo-img' ),
921					logoHeight = logo.height();
922
923				// Check to see if original height is set on scroll while the page is reloading.
924				if ( 'undefined' !== typeof logo.data('origHeight') ) {
925					logoHeight = parseInt( logo.data('origHeight') );
926				}
927
928				logo.css( 'max-height', logoHeight );
929
930				setTimeout( function() {
931					$('.fl-page-header').addClass( 'fl-shrink-header-transition' );
932
933					// Shrink on page load
934					if ( distanceY > shrinkOn ) {
935						header.addClass( 'fl-shrink-header' );
936					}
937					else {
938						header.removeClass( 'fl-shrink-header' );
939					}
940				}, 100 );
941			});
942		},
943
944		/**
945		 * Enable or disable header shrinking.
946		 *
947		 * @since 1.5
948		 * @access private
949		 * @method _shrinkHeaderEnable
950		 */
951		_shrinkHeaderEnable: function()
952		{
953			var win = $( window );
954
955			if ( win.width() >= window.themeopts.medium_breakpoint ) {
956
957				var header             = $('.fl-page-header'),
958					headerHeight       = header.outerHeight(),
959					topbar             = $('.fl-page-bar'),
960					topbarHeight       = 0,
961					totalHeaderHeight  = 0;
962
963				if( topbar.length != 0 ) {
964					topbarHeight      += topbar.outerHeight();
965					totalHeaderHeight  = topbarHeight + headerHeight;
966
967					if ( $( 'body.admin-bar' ).length != 0 ) {
968						topbarHeight += 32;
969					}
970					header.css( 'top' , topbarHeight );
971				}
972				else {
973					totalHeaderHeight = headerHeight;
974				}
975
976				// Fix: Themer parts layout inserted before header.
977				if ( header.prevAll( '.fl-builder-content' ).length > 0 ) {
978					FLTheme._initThemerLayoutFix();
979
980					totalHeaderHeight = topbar.outerHeight();
981				}
982
983				if ( $('.fl-header-padding-top-custom').length === 0 ) {
984					$( '.fl-page' ).css( 'padding-top', totalHeaderHeight );
985				}
986
987				$( win ).on( 'scroll.fl-shrink-header', FLTheme._shrinkHeader );
988			}
989			else {
990				$('.fl-page-header').css('top', 0);
991				$( '.fl-page' ).css( 'padding-top', 0 );
992				$( win ).off( 'scroll.fl-shrink-header' );
993			}
994		},
995
996		/**
997		 * Shrink the header.
998		 *
999		 * @since 1.5.1
1000		 * @access private
1001		 * @method _shrinkHeader
1002		 */
1003		_shrinkHeader: function()
1004		{
1005			var distanceY = $( this ).scrollTop(),
1006				shrinkOn  = 250,
1007				header    = $( '.fl-page-header' ),
1008				logo      = null;
1009
1010			$('.fl-page-header-logo').imagesLoaded(function(){
1011				logo = $( '.fl-logo-img' );
1012
1013				if ( 'undefined' === typeof logo.data('origHeight') ) {
1014					logo.data( 'origHeight', logo.height() );
1015				}
1016
1017				if ( distanceY > shrinkOn ) {
1018					header.addClass( 'fl-shrink-header' );
1019				}
1020				else {
1021					header.removeClass( 'fl-shrink-header' );
1022				}
1023
1024				if ( 'undefined' !== typeof header.data( 'original-top' ) ) {
1025					FLTheme._fixThemerLayoutOnScroll();
1026				}
1027			});
1028		},
1029
1030		/**
1031		 * Fixed Header (Fixed)
1032		 *
1033		 * @since 1.5
1034		 * @access private
1035		 * @method _fixedHeader
1036		 */
1037		_fixedHeader: function()
1038		{
1039		 	var win               = $(window),
1040		 		header            = $('.fl-page-header'),
1041		 		headerHeight      = 0,
1042		 		totalHeaderHeight = 0,
1043		 		bar               = $('.fl-page-bar'),
1044		 		barHeight         = 0;
1045
1046		 	if(win.width() >= window.themeopts.medium_breakpoint) {
1047
1048		 		headerHeight = header.outerHeight();
1049
1050		 		if( bar.length != 0 ) {
1051
1052		 			barHeight         = bar.outerHeight();
1053		 			totalHeaderHeight = barHeight + headerHeight;
1054
1055		 			if($('body.admin-bar').length != 0) {
1056		 				barHeight += 32;
1057		 			}
1058
1059		 			if($('html.fl-builder-edit').length != 0) {
1060		 				var topbarHeight = topbarHeight+11;
1061		 			}
1062
1063		 			header.css('top', barHeight);
1064		 		}
1065		 		else {
1066		 			totalHeaderHeight = headerHeight;
1067		 		}
1068
1069				// Fix: Themer parts layout.
1070				if ( header.prevAll( '.fl-builder-content' ).length > 0 ) {
1071					FLTheme._initThemerLayoutFix();
1072					totalHeaderHeight = bar.outerHeight();
1073
1074					$( win ).on( 'scroll.fl-fixed-header', FLTheme._fixThemerLayoutOnScroll );
1075				}
1076
1077				if($('body.fl-scroll-header').length === 0 && $('.fl-header-padding-top-custom').length === 0 ) {
1078					$('.fl-page').css('padding-top', totalHeaderHeight);
1079				}
1080
1081				$( win ).trigger( 'scroll' );
1082		 	}
1083		 	else {
1084		 		$('.fl-page-header').css('top', 0);
1085		 		$('.fl-page').css('padding-top', 0);
1086				$( win ).off( 'scroll.fl-fixed-header' );
1087		 	}
1088		},
1089
1090		/**
1091		 * Fixed Header (Fade In)
1092		 *
1093		 * Enables the fixed header if the window is wide enough.
1094		 *
1095		 * @since 1.0
1096		 * @access private
1097		 * @method _enableFixedHeader
1098		 */
1099		_enableFixedHeader: function()
1100		{
1101			var win = $(window);
1102
1103			if(win.width() < window.themeopts.medium_breakpoint) {
1104				win.off('scroll.fl-page-header-fixed');
1105				$('.fl-page-header-fixed').hide();
1106			}
1107			else {
1108				win.on('scroll.fl-page-header-fixed', FLTheme._toggleFixedHeader);
1109			}
1110		},
1111
1112		/**
1113		 * Fix the Themer parts layout that are hooks into `fl_page_open`.
1114		 *
1115		 * @since 1.7
1116		 * @access private
1117		 * @method _fixThemerLayout
1118		 */
1119		_initThemerLayoutFix: function() {
1120			var header             = $('.fl-page-header'),
1121				themerLayouts      = header.prevAll( '.fl-builder-content' ),
1122				themerlayoutHeight = 0;
1123
1124			if ( ! themerLayouts.length ) {
1125				return;
1126			}
1127
1128			header.css('position', 'initial');
1129
1130			$.each( themerLayouts, function() {
1131				themerlayoutHeight += $( this ).outerHeight();
1132			});
1133
1134			header.data( 'original-top', themerlayoutHeight );
1135		},
1136
1137		/**
1138		 * Fix the Themer parts layout on scroll.
1139		 *
1140		 * @since 1.7
1141		 * @access private
1142		 * @method _fixThemerLayout
1143		 */
1144		_fixThemerLayoutOnScroll: function() {
1145			var distanceY     = $( window ).scrollTop(),
1146				header        = $( '.fl-page-header' ),
1147				headerTop     = header.data( 'original-top' );
1148
1149			if ( 'undefined' === typeof headerTop ) {
1150				return;
1151			}
1152
1153			if ( distanceY >= headerTop ) {
1154				header.css( 'position', 'fixed' );
1155			}
1156			else {
1157				header.css( 'position', 'initial' );
1158			}
1159
1160			// Fix animations.
1161			if ( 'undefined' != typeof Waypoint ) {
1162				Waypoint.refreshAll();
1163			}
1164		},
1165
1166		/**
1167		 * Shows or hides the fixed header based on the
1168		 * window's scroll position.
1169		 *
1170		 * @since 1.0
1171		 * @access private
1172		 * @method _toggleFixedHeader
1173		 */
1174		_toggleFixedHeader: function()
1175		{
1176			var win             = $(window),
1177				fixed           = $('.fl-page-header-fixed'),
1178				fixedVisible    = fixed.is(':visible'),
1179				header          = $('.fl-page-header-primary'),
1180				headerHidden    = false;
1181
1182			if ( 0 === header.length ) {
1183				headerHidden = win.scrollTop() > 200;
1184			}
1185			else {
1186				headerHidden = win.scrollTop() > header.height() + header.offset().top;
1187			}
1188
1189			if(headerHidden && !fixedVisible) {
1190				fixed.stop().fadeIn(200);
1191			}
1192			else if(!headerHidden && fixedVisible) {
1193				fixed.stop().hide();
1194			}
1195		},
1196
1197		/**
1198		 * Adds logo as nav item for "centered inline logo" header layout.
1199		 *
1200		 * @since 1.5
1201		 * @access private
1202		 * @method _centeredInlineLogo
1203		 */
1204		_centeredInlineLogo: function()
1205		{
1206			var win               = $(window),
1207				$logo             = $( '.fl-page-nav-centered-inline-logo .fl-page-header-logo' ).eq( 0 ),
1208				$inline_logo      = $( '.fl-logo-centered-inline .fl-page-header-logo' ),
1209				$nav              = $( '.fl-page-nav-centered-inline-logo .fl-page-nav .navbar-nav' ),
1210				nav_li_length     = $nav.children('li').length,
1211				logo_li_location  = Math.round( nav_li_length / 2 ) - 1,
1212				$header_row       = $( '.fl-page-nav-centered-inline-logo .fl-page-header-row' );
1213
1214			if(win.width() >= window.themeopts.medium_breakpoint && $inline_logo.length < 1 && !$('.fl-page-header-primary').hasClass('fl-page-nav-toggle-visible-always')) {
1215
1216				if( $logo.hasClass( 'fl-inline-logo-left' ) && nav_li_length % 2 != 0 ) {
1217					$nav.children( 'li:nth( '+logo_li_location+' )' ).before( '<li class="fl-logo-centered-inline"></li>' );
1218				} else {
1219					$nav.children( 'li:nth( '+logo_li_location+' )' ).after( '<li class="fl-logo-centered-inline"></li>' );
1220				}
1221
1222				$nav.children( '.fl-logo-centered-inline' ).append( $logo );
1223		 	}
1224
1225		 	if(win.width() < window.themeopts.medium_breakpoint) {
1226				 $( '.fl-logo-centered-inline' ).remove();
1227
1228				if ( $header_row.children( '.fl-page-header-logo').length < 1 ) {
1229					$header_row.prepend( $inline_logo );
1230				}
1231		 	}
1232		},
1233
1234		/**
1235		 * Hide Header Until Scroll
1236		 *
1237		 * @since 1.5
1238		 * @access private
1239		 * @method _scrollHeader
1240		 */
1241		_scrollHeader: function()
1242		{
1243			var win      = $(window),
1244				header   = null,
1245				distance = $('.fl-page-header-primary').data('fl-distance'),
1246				headerHeight = 0;
1247
1248			if($('.fl-page-bar').length != 0 ) {
1249				header = $('.fl-page-header-primary, .fl-page-bar');
1250			}
1251			else {
1252				header = $('.fl-page-header-primary');
1253			}
1254
1255			if(win.width() >= window.themeopts.medium_breakpoint) {
1256				win.on('scroll.fl-show-header-on-scroll', function () {
1257					if ($(this).scrollTop() > distance) {
1258						header.addClass('fl-show');
1259					}
1260					else {
1261						header.removeClass('fl-show');
1262
1263						// Offcanvas nav layout fix.
1264						if ( $('.fl-responsive-nav-enabled').length ) {
1265							headerHeight = $('.fl-page-header-primary').height() * 2;
1266
1267							if ( $('.fl-page-bar').length != 0 ) {
1268								headerHeight += $('.fl-page-bar').height();
1269							}
1270
1271							if ( 'undefined' !== typeof $( '.fl-nav-offcanvas-collapse' ).css('top') ) {
1272								headerHeight += parseInt( $( '.fl-nav-offcanvas-collapse' ).css('top') );
1273							}
1274						}
1275
1276						if ( $( '.fl-nav-offcanvas-active' ).length && headerHeight > 0 ) {
1277							$( '.fl-nav-offcanvas-collapse' ).css({
1278								'transform' 		: 'translateY(' + headerHeight + 'px)',
1279								'-ms-transform' 	: 'translateY(' + headerHeight + 'px)',
1280								'-webkit-transform' : 'translateY(' + headerHeight + 'px)'
1281							});
1282						}
1283					}
1284				});
1285			}
1286			else {
1287				win.off('scroll.fl-show-header-on-scroll');
1288				$( '.fl-nav-offcanvas-collapse' ).css('transform', '');
1289			}
1290		},
1291
1292		/**
1293		 * Mega Menu
1294		 *
1295		 * @see _isResponsiveNavEnabled
1296		 * @since 1.5
1297		 * @access private
1298		 * @method _megaMenu
1299		 */
1300		_megaMenu: function()
1301		{
1302			var win      			= $(window),
1303				pageHeaderMenu 		= $('.fl-page-header'),
1304				menuContainer 		= pageHeaderMenu.find('.fl-page-header-container'),
1305				menuWidthLimit 		= menuContainer.outerWidth(),
1306				megaItem			= null,
1307				megaItems 			= null,
1308				megaContentWidth 	= 0;
1309
1310			pageHeaderMenu.find( 'li.mega-menu, li.mega-menu-disabled' ).each(function(){
1311				megaItem 			= $(this);
1312				megaContentWidth 	= megaItem.find('> ul.sub-menu').outerWidth();
1313
1314				if ( typeof megaItem.data('megamenu-width') !== 'undefined' ) {
1315					megaContentWidth = megaItem.data('megamenu-width');
1316				}
1317
1318				if( ( megaItem.hasClass('mega-menu') && menuWidthLimit < megaContentWidth ) || FLTheme._isResponsiveNavEnabled() ) {
1319					megaItem.data('megamenu-width', megaContentWidth);
1320
1321					// Fixed width issue on window resize
1322					if ( FLTheme._isResponsiveNavEnabled() ) {
1323						megaItem.find('> ul.sub-menu').css('display', 'block');
1324					}
1325
1326					megaItem.removeClass('mega-menu');
1327					if (!megaItem.hasClass('mega-menu-disabled')) {
1328						megaItem.addClass('mega-menu-disabled');
1329					}
1330				}
1331				else if ( megaItem.hasClass('mega-menu-disabled') && menuWidthLimit >= megaContentWidth ) {
1332					// Reset sub-menu display style
1333					megaItem.find('> ul.sub-menu').css('display', '');
1334
1335					megaItem.removeClass('mega-menu-disabled');
1336					if (!megaItem.hasClass('mega-menu')) {
1337						megaItem.addClass('mega-menu');
1338					}
1339					megaItem.addClass( 'mega-menu-items-' + megaItem.children( 'ul' ).children( 'li' ).length );
1340				}
1341			});
1342
1343
1344		},
1345
1346		/**
1347		 * Mega Menu - Fixed Header
1348		 *
1349		 * @since 1.5
1350		 * @access private
1351		 * @method _megaMenuOnScroll
1352		 */
1353		_megaMenuOnScroll: function()
1354		{
1355			var win      		= $(window),
1356				pageHeaderFixed = $('.fl-page-header-fixed'),
1357				menuContainer 	= pageHeaderFixed.find('.fl-page-header-container'),
1358				fixedVisible 	= pageHeaderFixed.is(':visible'),
1359				megaItem		= null,
1360				megaMenuContent = null;
1361
1362			if ( fixedVisible ) {
1363				pageHeaderFixed.find( 'li.mega-menu' ).each(function(){
1364					megaItem 		= $(this);
1365					megaMenuContent = megaItem.find('> ul.sub-menu');
1366
1367					// Disable mega menu if it's off screen
1368					if(menuContainer.outerWidth() < megaMenuContent.outerWidth()) {
1369						megaItem.removeClass('mega-menu');
1370						if (!megaItem.hasClass('mega-menu-disabled')) {
1371							megaItem.addClass('mega-menu-disabled');
1372						}
1373					}
1374					else {
1375						megaItem.removeClass('mega-menu-disabled');
1376						if (!megaItem.hasClass('mega-menu')) {
1377							megaItem.addClass('mega-menu');
1378						}
1379
1380						megaItem.addClass( 'mega-menu-items-' + megaItem.children( 'ul' ).children( 'li' ).length );
1381					}
1382				});
1383
1384				win.off('scroll.fl-mega-menu-on-scroll');
1385				win.off('resize.fl-mega-menu-on-scroll');
1386			}
1387		},
1388
1389		/**
1390		 * Fixed headers not be fixed when the builder is active
1391		 *
1392		 * @since 1.5.2
1393		 * @access private
1394		 * @method _fixedHeadersWhenBuilderActive
1395		 */
1396		_fixedHeadersWhenBuilderActive: function()
1397		{
1398			if($('body.fl-shrink').length != 0) {
1399				$('body').removeClass('fl-shrink');
1400			}
1401
1402			if($('body.fl-fixed-header').length != 0) {
1403				$('body').removeClass('fl-fixed-header');
1404			}
1405
1406			if($('body.fl-scroll-header').length != 0) {
1407				$('body').removeClass('fl-scroll-header');
1408			}
1409		},
1410
1411		/**
1412		 * Responsive Nav Layout
1413		 *
1414		 * @since 1.7
1415		 * @access private
1416		 * @method _setupMobileNavLayout
1417		 */
1418		_setupMobileNavLayout: function()
1419		{
1420			var win       = $( window ),
1421			    button    = $( 'button.navbar-toggle' ),
1422				header    = $( '.fl-page-header:not(.fl-page-header-fixed)' ),
1423				navBar    = header.find( '.fl-page-nav-collapse' ),
1424				pageWrap  = $( '.fl-page' ),
1425				navBarTop = 0,
1426				navHeight = win.height(),
1427				pushOpacity = $( 'body').hasClass( 'fl-offcanvas-push-opacity-left' ) || $( 'body').hasClass( 'fl-offcanvas-push-opacity-right' ),
1428				logoPos   = header.find( '.fl-page-header-logo' ).offset();
1429
1430			if ( FLTheme._isResponsiveNavEnabled() && button.is( ':visible' ) ) {
1431				$( 'body' ).addClass( 'fl-responsive-nav-enabled' );
1432
1433				button.attr( 'data-toggle', 'offcanvas');
1434				navBar.addClass( 'fl-nav-offcanvas-collapse');
1435
1436				if ( 0 === navBar.find( '.fl-button-close' ).length ) {
1437					navBar.prepend( '<div class="fl-button-close"><button class="fl-offcanvas-close" aria-label="Close Menu"><i class="fas fa-times"></i></button></div>' );
1438				}
1439
1440				if ( pushOpacity && 0 === $( '.fl-offcanvas-opacity' ).length ) {
1441					pageWrap.append( '<div class="fl-offcanvas-opacity"></div>' );
1442				}
1443
1444				if ( pageWrap.height() > win.height() ) {
1445					navHeight = $( document ).height();
1446
1447					if ( $( 'body.fl-shrink' ).length != 0 ) {
1448						navHeight = navHeight - header.height();
1449					}
1450				}
1451
1452				if ( $( 'body.admin-bar' ).length != 0 ) {
1453					navBarTop = $( '#wpadminbar' ).height();
1454					navHeight = navHeight - navBarTop;
1455				}
1456
1457				if ( $( '.fl-page-bar' ).length != 0 && ! $( '.fl-page-header' ).hasClass( 'fl-page-nav-toggle-button' ) ) {
1458					navBarTop = navBarTop + ($( '.fl-page-bar' ).height() + 1);
1459				}
1460
1461				if ( $('.fl-scroll-header').length && win.width() >= window.themeopts.medium_breakpoint ) {
1462					navBar.css('top', pageWrap.offset().top - navBarTop + 'px' );
1463				}
1464				else {
1465					navBar.css('top', '');
1466				}
1467
1468			}
1469			else {
1470				button.attr( 'data-toggle', 'collapse');
1471				navBar.removeClass( 'fl-nav-offcanvas-collapse');
1472				navBar.find( '.fl-button-close' ).remove();
1473				navBar.css( 'height', '' );
1474				navBar.css( 'top', '' );
1475				pageWrap.removeClass( 'fl-nav-offcanvas-active' );
1476				$( 'body' ).find( '.fl-offcanvas-opacity' ).remove();
1477				$( 'body' ).removeClass( 'fl-responsive-nav-enabled' );
1478			}
1479		},
1480
1481		/**
1482		 * Toggle the Responsive Nav Layout
1483		 *
1484		 * @since 1.7
1485		 * @access private
1486		 * @method _toggleMobileNavLayout
1487		 */
1488		_toggleMobileNavLayout: function()
1489		{
1490
1491			$( '.fl-page-nav' ).on( 'click', '.fl-offcanvas-close', function(e){
1492				$( '.fl-page' ).toggleClass( 'fl-nav-offcanvas-active' );
1493				e.stopPropagation();
1494			});
1495
1496		},
1497
1498		/**
1499		 * Apply footer height as margin-bottom value for fl-page class
1500		 *
1501		 * @since 1.5
1502		 * @access private
1503		 * @method _footerEffect
1504		 */
1505		_footerEffect: function()
1506		{
1507			if ( $( window ).width() >= window.themeopts.mobile_breakpoint ) {
1508				$( '.fl-page' ).css( 'margin-bottom', $( '.fl-page-footer-wrap' ).height() );
1509			}
1510			else {
1511				$( '.fl-page' ).css( 'margin-bottom', 0 );
1512			}
1513		},
1514
1515		/**
1516		 * Go to Top
1517		 *
1518		 * @since 1.5
1519		 * @access private
1520		 * @method _toTop
1521		 */
1522		_toTop: function()
1523		{
1524			var buttons = $('#fl-to-top');
1525
1526			buttons.each(function(){
1527				$(this).click(function(){
1528					$('html,body').animate({ scrollTop: 0 }, 'linear');
1529					return false;
1530				});
1531			});
1532
1533			$(window).scroll(function(){
1534				if( $(this).scrollTop() > window.themeopts.scrollTopPosition ) {
1535					buttons.fadeIn();
1536				} else {
1537					buttons.fadeOut();
1538				}
1539			});
1540		},
1541
1542		/**
1543		 * Initializes the lightbox.
1544		 *
1545		 * @since 1.0
1546		 * @access private
1547		 * @method _enableLightbox
1548		 */
1549		_enableLightbox: function()
1550		{
1551			var body = $('body');
1552
1553			if ( 'disabled' === window.themeopts.lightbox ) {
1554				return;
1555			}
1556
1557			// Only works on NON bb pages/posts
1558			if( !body.hasClass('fl-builder') && !body.hasClass('woocommerce')) {
1559
1560				$('.fl-content a').filter(function() {
1561					return /\.(png|jpg|jpeg|gif|webp)(\?.*)?$/i.test(this.href);
1562				}).magnificPopup({
1563					closeBtnInside: false,
1564					type: 'image',
1565					gallery: {
1566						enabled: true
1567					}
1568				});
1569			}
1570
1571			if( ( body.hasClass('fl-builder') || body.hasClass( 'fl-theme-builder-singular' ) ) && !body.hasClass('woocommerce') ) {
1572				$('.fl-rich-text a, .fl-module-fl-post-content a').filter(function() {
1573					return /\.(png|jpg|jpeg|gif|webp)(\?.*)?$/i.test(this.href);
1574				}).magnificPopup({
1575					closeBtnInside: false,
1576					type: 'image',
1577					gallery: {
1578						enabled: true
1579					}
1580				});
1581			}
1582		},
1583
1584		/**
1585		 * Initializes the fitVids
1586		 *
1587		 * @since 1.5.2
1588		 * @access private
1589		 * @method _enableFitVids
1590		 */
1591		_enableFitVids: function()
1592		{
1593			$('.fl-post-content').fitVids();
1594		},
1595
1596		/**
1597		 * Check to see if responsive nav is enabled for the current window width
1598		 *
1599		 * @since 1.6.2
1600		 * @access private
1601		 * @method _isResponsiveNavEnabled
1602		 */
1603		_isResponsiveNavEnabled: function()
1604		{
1605			var win 	= $(window);
1606				enabled = false;
1607
1608			if ( ( $( '.fl-page-nav-toggle-visible-always' ).length > 0 )
1609				|| ( $( '.fl-page-nav-toggle-visible-medium-mobile' ).length > 0 && win.width() < window.themeopts.medium_breakpoint )
1610				|| ( $( '.fl-page-nav-toggle-visible-mobile' ).length > 0 && win.width() < window.themeopts.mobile_breakpoint )
1611				) {
1612				enabled = true;
1613			}
1614
1615			return enabled;
1616		}
1617	};
1618
1619	$(function(){
1620		FLTheme.init();
1621	});
1622
1623	// Mobile Logo
1624	if ( ! ( $( 'html.fl-builder-edit' ).length !== 0 ) ) {
1625		FLTheme._initMobileHeaderLogo();
1626	}
1627	FLTheme._initRetinaImages();
1628
1629})(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.