PageSourceSearch

https://bawabali.com/wp-content/themes/wpbstarter/assets/js/sina-nav.js?ver=2.1.0

js bawabali.com collected 2026-10-02 12:20:51 UTC 8,725 bytes, 289 lines download raw bytes

1/**
2 * Template name: Sina-nav Multi Purpose Menu
3 * Template URI: https://github.com/shaonsina/sina-nav-4
4 * Version: 2.1
5 * Author: shaonsina
6 */
7
8(function ($) {
9	'use strict';
10	$.fn.sinaNav = function () {
11		return this.each( function() {
12			var getNav		= $(this),
13				top 		= getNav.data('top') || getNav.offset().top,
14				mdTop 		= getNav.data('md-top') || getNav.offset().top,
15				xlTop 		= getNav.data('xl-top') || getNav.offset().top,
16				navigation 	= getNav.find('.sina-menu'),
17				getWindow 	= $(window).outerWidth(),
18				anim 		= getNav.data('animate-prefix') || '',
19				getIn 		= navigation.data('in'),
20				getOut 		= navigation.data('out');
21
22				$(window).on('resize', function(){
23					getWindow 	= $(window).outerWidth();
24				});
25
26			// Active Class Add & Remove 
27			// ---------------------------
28			getNav.find('.sina-menu').each(function(){
29				var $menu = $(this);
30				$menu.on('click', function(e) {
31					if ( 'A' == e.target.tagName ) {
32						$menu.find('li.active').removeClass('active');
33						$(e.target).parent().addClass('active');
34					}
35				});
36
37				$menu.find('li.active').removeClass('active');
38				$menu.find( 'a[href="'+ location.href +'"]' ).parent('li').addClass('active');
39			});
40
41			// Navbar Center 
42			// ---------------------------------
43			if( getNav.hasClass('logo-center')){
44				var mainNav		= getNav.find('.sina-menu'),
45					rightNav 	= mainNav.clone(),
46					lists 		= mainNav.children('li'),
47					divided 	= Math.round(lists.length / 2);
48
49				// Remove All list item for newly creation
50				mainNav.empty();
51				rightNav.empty();
52
53				// Create left part
54				for (var i = 0; i < divided; i++) {
55					mainNav.append( lists[i] );
56				}
57				mainNav.addClass('sina-menu-right').wrap('<div class="col-half left"></div>');
58
59				// Create right part
60				for (var i = divided; i < lists.length; i++) {
61					rightNav.append( lists[i] );
62				}
63				getNav.find('.col-half.left').after( rightNav.addClass('sina-menu-dropdown-right sina-menu-left') );
64				rightNav.wrap('<div class="col-half right"></div>');
65			}
66
67			// Mobile Sidebar
68			// ---------------------------------
69			if( getNav.hasClass('mobile-sidebar') ) {
70				var $collapse = getNav.find('.navbar-collapse');
71
72				// Add Class to body
73				if ( $('body').children('.wrapper').length < 1 ) {
74					$('body').wrapInner('<div class="wrapper"></div>');
75				}
76
77				if ( getNav.hasClass('navbar-reverse') ) {
78					$collapse.on('shown.bs.collapse', function() {
79						$('body').addClass('mobile-right');
80					});
81					$collapse.on('hide.bs.collapse', function() {
82						$('body').removeClass('mobile-right');
83					});
84					$(window).on('resize', function(){
85						$('body').removeClass('mobile-right');
86						getNav.find('.navbar-collapse').removeClass('show');
87						//getNav.find('.navbar-toggle .fa', this).removeClass('fa-times').addClass('fa-bars');
88					});
89				}
90				else{
91					$collapse.on('shown.bs.collapse', function() {
92						$('body').addClass('mobile-left');
93					});
94					$collapse.on('hide.bs.collapse', function() {
95						$('body').removeClass('mobile-left');
96					});
97					$(window).on('resize', function(){
98						$('body').removeClass('mobile-left');
99						getNav.find('.navbar-collapse').removeClass('show');
100						//getNav.find('.navbar-toggle .fa', this).removeClass('fa-times').addClass('fa-bars');
101					});
102				}
103			}
104
105			// Navbar Fixed
106			// ---------------------------------
107			function freezNav() {
108				var scrollTop = $(window).scrollTop(),
109					winWidth  = $(window).outerWidth();
110
111				if( winWidth > 1599 && scrollTop > xlTop ){
112					getNav.addClass('navbar-freez');
113				}
114				else if( winWidth < 1600 && winWidth > 1199 && scrollTop > top ){
115					getNav.addClass('navbar-freez');
116				}
117				else if( winWidth < 1200 && winWidth > 1024 && scrollTop > mdTop ){
118					getNav.addClass('navbar-freez');
119				}
120				else {
121					getNav.removeClass('navbar-freez');
122				}
123			}
124			if( getNav.hasClass('navbar-fixed') ){
125
126				$(window).on('scroll', function(){
127					freezNav();
128				});
129				$(window).on('resize', function(){
130					freezNav();
131				});
132
133				if ( getWindow > 1024 && $(window).scrollTop() > top ) {
134					getNav.addClass('navbar-freez');
135				}
136			}
137
138			// Navbar Transparent
139			// ---------------------------------
140			function transNav() {
141				var scrollTop = $(window).scrollTop(),
142					winWidth  = $(window).outerWidth();
143
144				if( winWidth > 1599 && scrollTop > xlTop ){
145					getNav.removeClass('navbar-transparent');
146				}
147				else if( winWidth < 1600 && winWidth > 1199 && scrollTop > top ){
148					getNav.removeClass('navbar-transparent');
149				}
150				else if( winWidth < 1200 && winWidth > 1024 && scrollTop > mdTop ){
151					getNav.removeClass('navbar-transparent');
152				}
153				else {
154					getNav.addClass('navbar-transparent');
155				}
156			}
157			if( getNav.hasClass('navbar-transparent') ){
158
159				$(window).on('scroll', function(){
160					transNav();
161				});
162				$(window).on('resize', function(){
163					transNav();
164				});
165
166				if ( getWindow > 1024 && $(window).scrollTop() > top ) {
167					getNav.removeClass('navbar-transparent');
168				}
169			}
170
171			// Search-box
172			// ---------------------------------
173			getNav.find('.extension-nav').each(function(){
174				$('.search > a', this).on('click', function(e){
175					e.preventDefault();
176					$('.search-box').slideToggle();
177				});
178			});
179			$('.search-addon.close-search').on('click', function(){
180				$('.search-box').slideUp();
181			});
182
183			// Widget-bar
184			// ---------------------------------
185			getNav.find('.extension-nav').each(function(){
186				$('.widget-bar-btn > a', this).on('click', function(e){
187					e.preventDefault();
188					getNav.children('.sina-nav-overlay').fadeIn(400);
189					getNav.children('.widget-bar').toggleClass('on');
190				});
191			});
192			getNav.find('.widget-bar .close-widget-bar').on('click', function(e){
193				e.preventDefault();
194				getNav.children('.widget-bar').removeClass('on');
195				getNav.children('.sina-nav-overlay').fadeOut(600);
196			});
197			getNav.children('.sina-nav-overlay').on('click', function() {
198				getNav.children('.widget-bar').removeClass('on');
199				$(this).fadeOut(600);
200			});
201
202			// Toggle Button
203			// getNav.find('.navbar-toggle').on('click', function(){
204			// 	$('.fa', this).toggleClass('fa-bars').toggleClass('fa-times');
205			// });
206
207
208			// Eevent
209			// -------------------------------------
210			getNav.find('.sina-menu, .extension-nav').each(function(){
211				var menu = this;
212
213				$('.dropdown-toggle', menu).on('click', function (e) {
214					e.stopPropagation();
215					return false;
216				});
217
218				$('.dropdown-menu', menu).addClass(anim+'animated');
219
220
221				$('.dropdown', menu).on('focusin', function(){
222					var dropdown = this;
223
224					$('.dropdown-menu', dropdown).eq(0).removeClass(getOut).stop().fadeIn().addClass(getIn);
225					$(dropdown).addClass('on');
226				}); 
227				
228				$('.dropdown', menu).on('focusout', function(){
229					var dropdown = this;
230
231					$('.dropdown-menu', dropdown).eq(0).removeClass(getIn).stop().fadeOut().addClass(getOut);
232					$(dropdown).removeClass('on');
233				}); 
234				
235				$('.dropdown', menu).on('mouseenter', function(){
236					var dropdown = this;
237
238					$('.dropdown-menu', dropdown).eq(0).removeClass(getOut).stop().fadeIn().addClass(getIn);
239					$(dropdown).addClass('on');
240				});
241				$('.dropdown', menu).on('mouseleave', function(){
242					var dropdown = this;
243
244					$('.dropdown-menu', dropdown).eq(0).removeClass(getIn).stop().fadeOut().addClass(getOut);
245					$(dropdown).removeClass('on');
246				});
247				$('.mega-menu-col', menu).children('.sub-menu').removeClass('dropdown-menu '+anim+'animated');
248			});
249
250			if( getWindow < 1025 ) {
251				// Megamenu
252				getNav.find('.menu-item-has-mega-menu').each(function(){
253					var megamenu 	= this,
254						$columnMenus = [];
255
256					$('.mega-menu-col', megamenu).children('.sub-menu').addClass('dropdown-menu '+anim+'animated');
257					$('.mega-menu-col', megamenu).each(function(){
258						var megamenuColumn = this;
259
260						$('.mega-menu-col-title', megamenuColumn).on('mouseenter', function(){
261							var title = this;
262
263							$(title).closest('.mega-menu-col').addClass('on');
264							$(title).siblings('.sub-menu').stop().fadeIn().addClass(getIn);
265						});
266
267						if( !$(megamenuColumn).children().is('.mega-menu-col-title') ) {
268							$columnMenus.push( $(megamenuColumn).children('.sub-menu') );
269						}
270					});
271
272					$(megamenu).on('mouseenter', function(){
273						var submenu;
274						for (submenu in $columnMenus) {
275							$columnMenus[ submenu ].stop().fadeIn().addClass(getIn);
276						}	
277					});
278
279					$(megamenu).on('mouseleave', function() {
280						$('.dropdown-menu', megamenu).stop().fadeOut().removeClass(getIn);
281						$('.mega-menu-col', megamenu).removeClass('on');
282					});
283				});
284			}
285		});
286	}
287	// Initialize
288	$('.sina-nav').sinaNav();
289}(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.