PageSourceSearch

https://mbd-openmarketing.com/wp-content/themes/definity/definity/assets/js/main.js?ver=v1.0

js mbd-openmarketing.com collected 2026-10-09 22:43:04 UTC 15,019 bytes, 583 lines download raw bytes

1(function($){
2	'use strict';
3
4
5/* --------------------------------------------------
6	Initialization
7-------------------------------------------------- */
8
9    // Initialize all functions when the document is ready.
10	$(document).ready(function(){
11
12		initNavbar();
13		initAnimation();
14		initCircleCharts();
15		initNbrCounters();
16		initSliders();
17		initGallery();
18		initScroller();
19
20		if ( document.getElementById('shop-slider-range') ) {
21			initRangeSlider();
22		}
23
24		// Parallax disabled for mobile screens
25		if ($(window).width() >= 1260 ) {
26
27			$(window).stellar({
28				hideDistantElements: false
29			});
30		}
31
32	});
33
34	// Initialize functions after elements are loaded.
35	$(window).load(function() {
36
37		// Preloader
38		$('.preloader img').fadeOut(); // will first fade out the loading animation
39		$('.preloader').delay(350).fadeOut('slow', function() {
40
41		});
42
43		initPortfolio();
44		initBlogMasonry();
45
46	});
47
48
49/* --------------------------------------------------
50	WordPress - Custom Edits
51-------------------------------------------------- */
52
53	// Sidebar post single - serach widget icon
54	$('.widget_search input[type="submit"]').after('<i class="fa fa-search search_widget_icon"></i>');
55	$('.widget_search form input[type="text"]').attr('placeholder', 'Search...');
56
57	// Footer Widgets - newsletter plane icon
58	$('input[type="submit"].newsletter-widget-send-btn').before('<i class="fa fa-send-o footer_newsletter_send_icon"></i>');
59
60	// Add class to open the Magnific Lightbox for the gallery items in blog post
61	$('.bp-content .gallery .gallery-item .gallery-icon a').addClass('open-gallery');
62
63	// Adds class to Crypto price change
64	if ($('.ft-crypto-card')) {
65		$(".change-24 .wpuc-txt:contains('-')").parent().addClass('price-down');
66		$(".change-24 .wpuc-txt:contains('+')").parent().addClass('price-up');
67	}
68
69
70
71/* --------------------------------------------------
72	Navigation | Navbar
73-------------------------------------------------- */
74	function initNavbar () {
75
76
77		// Add 'navbar-ss' on mobile screens
78
79		$(window).resize(function() {
80
81			if ($(window).width() <= 992) {
82				$('nav.d-nav').addClass('navbar-ss');
83		    } else {
84		    	$('nav.d-nav').removeClass('navbar-ss');
85		    }
86
87		}).resize();
88
89
90
91		$(window).scroll(function() {
92
93			// Trans nav handler for sticky nav
94
95			if ($('nav').hasClass('d-nav-sticky')) {
96
97				if ($(window).scrollTop() >= 400) {
98					$('nav').removeClass('d-nav-trans', 305).animate(0);
99				} else {
100					if ($('nav').hasClass('d-nav-inline') || $('nav').hasClass('d-nav-full')) {
101						$('nav').addClass('d-nav-trans', 305).animate(0);
102					}
103				}
104
105				if ($(window).scrollTop() >= 400 && $('nav').hasClass('d-nav-float-on')) {
106					$('nav').removeClass('d-nav-neue-float');
107				} else if ($('nav').hasClass('d-nav-float-on')) {
108					$('nav').addClass('d-nav-neue-float');
109				}
110
111				if ($(window).scrollTop() >= 150 && $(window).scrollTop() <= 400 && $('nav').hasClass('d-nav-neue')) {
112					$('nav').addClass('d-nav-neue-sticky-handler');
113				} else {
114					$('nav').removeClass('d-nav-neue-sticky-handler');
115				}
116
117				if ($(window).scrollTop() <= 33) {
118					$('.d-has-nav-extended').addClass('d-sticky-ext-spacing');
119				} else {
120					$('.d-has-nav-extended').removeClass('d-sticky-ext-spacing');
121				}
122
123			}
124
125		});
126
127
128		// Hamburger Button
129
130		$('.d-mobile-nav-open').on('click', function() {
131			$('#navbar').addClass('mobile-menu-open');
132			$('.mobile-menu-wrapper').toggleClass('overlay-bg-on overlay-bg-off');
133		});
134
135		$('.d-mobile-nav-close').on('click', function() {
136			$('#navbar').removeClass('mobile-menu-open');
137			$('.mobile-menu-wrapper').toggleClass('overlay-bg-on overlay-bg-off');
138		});
139
140
141		//
142		// Dropdown Menu
143		//
144
145		if ( $('li.menu-item').hasClass('menu-item-has-children') ) {
146
147			// Add down icon if there is dropdown
148			$('li.menu-item-has-children').append('<i class="d-sub-menu-click-tigger fa fa-angle-down"></i>');
149
150
151			// Dropdown on hover/click
152			if ( $('#navbar').hasClass('d-nav-sub-on-click') ) {
153				$('li.menu-item-has-children').click(function(e) {
154					$(this).toggleClass('sub-menu-show');
155					$(this).siblings('li.menu-item-has-children').removeClass('sub-menu
155-show');
156				});
157			} else {
158				$('li.menu-item-has-children').hover(function() {
159					$(this).toggleClass('sub-menu-show', 300);
160				});
161			}
162
163
164			$('i.d-sub-menu-click-tigger').click(function() {
165
166				// Close the search before dropdown open (if exist)
167				if ($('form.mobile-menu-search')) {
168					$('form.mobile-menu-search').removeClass('mm-search-on').addClass('mm-search-off');
169					$('.search-dropdown-toggle').parent('li').removeClass('current-menu-item');
170				}
171
172				// Open the dropdown by clicking on the arrow
173				$('i.d-sub-menu-click-tigger').not(this).siblings('ul.sub-menu').removeClass('d-sub-menu-show');
174				$(this).toggleClass('rotate-arrow-up').siblings('ul.sub-menu').toggleClass('d-sub-menu-show');
175
176			});
177    	}
178
179			//
180			// One Page (mobile menu) close after clicked
181			// @updated: v2.2 - 15.05.19
182			if ( $('nav').hasClass('d-nav-sticky') ) {
183				$('.menu-item a').not('.menu-item a.search-dropdown-toggle').click(function() {
184					$('#navbar').removeClass('mobile-menu-open');
185					$('.mobile-menu-wrapper').removeClass('overlay-bg-on').addClass('overlay-bg-off');
186				})
187			}
188
189
190    	// Search | Mobile Menu
191
192    	$('.search-dropdown-toggle').click(function() {
193    		$(this).parent('li').toggleClass('current-menu-item');
194    		$('form.mobile-menu-search').toggleClass('mm-search-on mm-search-off');
195    		$('i.d-sub-menu-click-tigger').removeClass('rotate-arrow-up').siblings('ul.sub-menu').removeClass('d-sub-menu-show');
196    	});
197
198    	$('span.form-close').click(function() {
199    		$('.search-dropdown-toggle').parent('li').toggleClass('current-menu-item');
200    		$('form.mobile-menu-search').toggleClass('mm-search-on mm-search-off');
201    	});
202
203    	// Nav Extended - hide 'no-text' links
204
205    	$( "li.menu-item a:contains('no-text')" ).addClass('a-no-text').text('').parent().addClass('li-no-text');
206
207	} // initNavbar
208
209
210/* --------------------------------------------------
211	Counters Circles
212-------------------------------------------------- */
213
214	function initCircleCharts () {
215
216		$('.chart').easyPieChart({
217			size: '150',
218			lineWidth: 2,
219			lineCap: 'square',
220			trackColor: '',
221		    barColor: '#f8f8f8',
222		    scaleColor: false,
223		    easing: 'easeOutBack',
224		    animate: {
225		    	duration: 1600,
226		    	enabled: true
227		    }
228		});
229	}
230
231
232/* --------------------------------------------------
233	Number Counters
234-------------------------------------------------- */
235
236	function initNbrCounters () {
237
238		$('.count-nbr').each(function () {
239		    $(this).prop('Counter',0).animate({
240		        Counter: $(this).text()
241		    }, {
242		        duration: 4700,
243		        easing: 'easeOutBack',
244		        step: function (now) {
245		            $(this).text(Math.ceil(now));
246		        }
247		    });
248		});
249	}
250
251
252/* --------------------------------------------------
253	Sliders
254-------------------------------------------------- */
255
256	function initSliders() {
257
258		// Testimonials Sliders
259		$('.t-slider').each( function() {
260			var t_slider = $(this);
261			var arrows = $(this).data('arrows');
262			var speed = $(this).data('speed');
263			var autoplay = $(this).data('autoplay');
264			var autoplay_speed = $(this).data('autoplay_speed');
265			var animation = $(this).data('animation');
266			var adaptive_height = $(this).data('adaptive_height');
267
268			t_slider.slick({
269				speed: speed,
270				autoplay: autoplay,
271				autoplaySpeed: autoplay_speed,
272				fade: animation,
273				slidesToShow: 1,
274				slidesToScroll: 1,
275				adaptiveHeight: adaptive_height,
276				dots: false,
277				arrows: arrows,
278				prevArrow: '<button type="button" class="t-slider-nav slick-prev"><span class="linea-arrows-slim-left"></span></button>',
279				nextArrow: '<button type="button" class="t-slider-nav slick-next"><span class="linea-arrows-slim-right"></span></button>',
280			});
281		});
282
283		// Brands/Clients Slider
284		$('.clients-slider').each( function() {
285			var clients_slider = $(this);
286			var speed = $(this).data('speed');
287			var autoplay = $(this).data('autoplay');
288			var autoplay_speed = $(this).data('autoplay_speed');
289			var adaptive_height = $(this).data('adaptive_height');
290			var slides_to_show = $(this).data('slides_to_show');
291			var slides_to_scroll = $(this).data('slides_to_scroll');
292
293			clients_slider.slick({
294				speed: speed,
295				autoplay: autoplay,
296				autoplaySpeed: autoplay_speed,
297				adaptiveHeight: adaptive_height,
298				slidesToShow: slides_to_show, // 5
299				slidesToScroll: slides_to_scroll, // 1
300				dots: false,
301				arrows: false,
302				responsive: [
303				    {
304				      breakpoint: 999,
305				      settings: {
306				        slidesToShow: 3,
307				        slidesToScroll: 2,
308				        infinite: true,
309				      }
310				    },
311				    {
312				      breakpoint: 770,
313				      settings: {
314				        slidesToShow: 2,
315				        slidesToScroll: 1
316				      }
317				    },
318				    {
319				      breakpoint: 599,
320				      settings: {
321				        slidesToShow: 1,
322				        slidesToScroll: 1
323				      }
324				    }
325				]
326			});
327		});
328
329		// Portfolio Single Slider
330		$('.single-img-slider').each( function() {
331			var single_img_slider = $(this);
332			var speed = $(this).data('speed');
333			var arrows = $(this).data('arrows');
334			var dots = $(this).data('dots');
335			var autoplay = $(this).data('autoplay');
336			var autoplay_speed = $(this).data('autoplay_speed');
337			var animation = $(this).data('animation');
338			var adaptive_height = $(this).data('adaptive_height');
339			var slides_to_show = $(this).data('slides_to_show');
340			var slides_to_scroll = $(this).data('slides_to_scroll');
341
342			single_img_slider.slick({
343				speed: speed,
344				autoplay: autoplay, // true
345				autoplaySpeed: autoplay_speed, // 4000
346				slidesToShow: slides_to_show, // 1
347				slidesToScroll: slides_to_scroll, // 1
348				adaptiveHeight: adaptive_height, // true
349				fade: animation, // false
350				dots: dots, // false
351				arrows: arrows, // true
352				prevArrow: '<button type="button" class="slider-nav sl-prev"><span class="linea-arrows-slim-left"></span></button>',
353				nextArrow: '<button type="button" class="slider-nav sl-next"><span class="linea-arrows-slim-right"></span></button>',
354			});
355		});
356
357	} // initSliders
358
359
360/* --------------------------------------------------
361	Portfolio
362-------------------------------------------------- */
363
364	function initPortfolio () {
365
366		// Filters
367		$('.portfolio-filters a').click(function (e) {
368			  e.preventDefault();
369
370			  $('li').removeClass('active');
371			  $(this).parent().addClass('active');
372		});
373
374
375		// Full Width Gallery (3 columns)
376		function pfolio3colFW () {
377
378			var $container = $('#pfolio');
379			// init
380			$container.isotope({
381				// options
382				itemSelector: '.portfolio-item',
383			});
384
385			// Filter items
386			$('#pfolio-filters').on( 'click', 'a', function() {
387				var filterValue = $(this).attr('data-filter');
388				$container.isotope({ filter: filterValue });
389			});
390
391		} // fwNogap3col
392
393
394		function pfolioMasonry () {
395
396			var $container = $('.pfolio-items');
397			// init
398			$container.isotope({
399				// options
400				itemSelector: '.p-item',
401			    percentPosition: true,
402			    // layoutMode: 'packery',
403			    masonry: {
404			      columnWidth: '.grid-sizer'
405			    }
406			});
407
408			// Filter items
409			$('#pfolio-filters').on( 'click', 'a', function() {
410				var filterValue = $(this).attr('data-filter');
411				$container.isotope({ filter: filterValue });
412			});
413
414		}
415
416
417		// Portfolio (cutom post type)
418		function pfolioCPT () {
419
420			var $container = $('#pfolio-cpt');
421			// init
422			$container.isotope({
423				// options
424				itemSelector: '.pfolio-cpt-item',
425				percentPosition: true,
426				// layoutMode: 'packery',
427			});
428
429			// Filter items
430			$('#pfolio-cpt-filters').on( 'click', 'a', function() {
431				var filterValue = $(this).attr('data-filter');
432				$container.isotope({ filter: filterValue });
433			});
434
435		} // fwNogap3col
436
437
438		pfolio3colFW();
439		pfolioMasonry();
440		if ('#pfolio-cpt') {
441			pfolioCPT();
442		}
443
444	} // initPortfolio
445
446
447/* --------------------------------------------------
448	Light Gallery
449-------------------------------------------------- */
450
451	function initGallery () {
452
453		// Image Lightbox
454		var hasPopup = $('a').hasClass('open-gallery');
455
456		if (hasPopup) {
457
458			$('.open-gallery').magnificPopup({
459				type:'image',
460				gallery: {
461				    enabled: true
462				}
463			});
464
465		}
466
467		// Single Image Slider Lightbox
468		var hasSISPopup = $('a').hasClass('sis-open-gallery');
469
470		if (hasSISPopup) {
471
472			$('.sis-open-gallery').magnificPopup({
473				type:'image',
474				gallery: {
475				    enabled: true
476				}
477			});
478
479		}
480
481		// Video Lightbox
482		var hasVideoPopup = $('a').hasClass('popup-video');
483
484		if (hasVideoPopup) {
485
486			$('.popup-video').magnificPopup({
487	          	disableOn: 700,
488	         	type: 'iframe',
489	          	mainClass: 'mfp-fade',
490	          	removalDelay: 160,
491	          	preloader: false,
492
493	          	fixedContentPos: false
494			});
495
496		}
497
498	} // initGallery
499
500
501/* --------------------------------------------------
502	Blog Masonry Layout
503-------------------------------------------------- */
504
505	function initBlogMasonry () {
506
507		var $container = $('.blog-container');
508			// init
509			$container.isotope({
510				// options
511				itemSelector: '.blog-selector',
512				percentPosition: true
513			});
514	}
515
516
517/* --------------------------------------------------
518  Contact Pages
519-------------------------------------------------- */
520
521	$('.show-map').on('click', function(e){
522	  e.preventDefault();
523	  $('.contact-info-wrapper').toggleClass('map-open');
524	  $('.show-info-link').toggleClass('info-open');
525	});
526
527	$('.show-info-link').on('click', function(e){
528	  e.preventDefault();
529	  $('.contact-info-wrapper').toggleClass('map-open');
530	  $(this).toggleClass('info-open');
531	});
532
533
534/* --------------------------------------------------
535	Scroller
536-------------------------------------------------- */
537
538	function initScroller () {
539
540		$('a[href*="#"]')
541		  // Remove links that don't actually link to anything
542		  .not('[href="#"]')
543		  .not('[href="#0"]')
544		  .click(function(event) {
545		    // On-page links
546		    if (
547		      location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
548		      &&
549		      location.hostname == this.hostname
550		    ) {
551			      var target = $(this.hash);
552			      target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
553			      if (target.length) {
554			        event.preventDefault();
555			        $('html, body').animate({
556			          scrollTop: target.offset().top,
557			        }, 1050, function() {
558				          var $target = $(target);
559				          $target.focus();
560				          if ($target.is(":focus")) { // Checking if the target was focused
561				            return false;
562				          } else {
563				            $target.attr('tabindex','-1');
564				            $target.focus();
565				        }
566			        });
567			    }
568		    }
569		});
570	} // initScroller
571
572
573/* --------------------------------------------------
574	Animation
575-------------------------------------------------- */
576
577	function initAnimation () {
578
579		new WOW().init();
580
581	}
582
583})(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.