PageSourceSearch

http://www.smithmartinpartnership.com/wp-content/themes/fdesign/js/utilities.js?ver=7.0.3

js smithmartinpartnership.com collected 2026-10-06 22:45:51 UTC 5,389 bytes, 178 lines download raw bytes

1(function($) {
2
3	"use strict";
4
5	$( document ).ready(function() {
6
7		if ($('#wpadminbar').length > 0) {
8		
9			$('#header-main-fixed').css('top', $('#wpadminbar').height() + 'px');
10			$('#wpadminbar').css('position', 'fixed');
11		}
12
13		$('#header-spacer').height( $('#header-main-fixed').height() );
14
15		$(window).on('scroll', function () {
16
17			if ($(this).scrollTop() > 100) {
18
19				$('.scrollup').fadeIn();
20
21			} else {
22
23				$('.scrollup').fadeOut();
24
25			}
26		});
27
28		$('.scrollup').on('click', function () {
29			
30			$("html, body").animate({
31				  scrollTop: 0
32			  }, 600);
33
34			return false;
35		});
36
37		fdesign_mainMenuInit();
38
39		if ( $(window).width() < 800 ) {
40		
41			$('#navmain > div > ul > li').each(
42		       function() {
43		         if ($(this).find('> ul.sub-menu').length > 0) {
44
45		           $(this).prepend('<span class="sub-menu-item-toggle"></span>');
46		         }
47		       }
48		     );
49
50		   $('#navmain').on('focusin', function(){
51
52      if ($('#navmain > div > ul').css('right') == '-99999px') {
53
54        $('#navmain > div > ul').css({'right': 'auto'});
55        $('#navmain ul ul').css({'right': 'auto'}).css({'position': 'relative'});
56
57        $('.sub-menu-item-toggle').addClass('sub-menu-item-toggle-expanded');
58      }
59    });
60
61	$('#main-content-wrapper, #home-content-wrapper').on('focusin', function(){
62
63      if ($('#navmain > div > ul').css('right') != '-99999px') {
64        $('#navmain > div > ul').css({'right': '-99999px'});  
65      }
66
67    });
68
69   $('.sub-menu-item-toggle').on('click', function(e) {
70
71		     e.stopPropagation();
72
73		     var subMenu = $(this).parent().find('> ul.sub-menu');
74
75		     $('#navmain ul ul.sub-menu').not(subMenu).css('right', '-99999px').css('position', 'absolute');
76		     $(this).toggleClass('sub-menu-item-toggle-expanded');
77		     if (subMenu.css('right') == '-99999px') {
78
79        subMenu.css({'right': 'auto'}).css({'position': 'relative'});
80        subMenu.find('ul.sub-menu').css({'right': 'auto'}).css({'position': 'relative'});
81
82     } else {
83
84        subMenu.css({'right': '-99999px'}).css({'position': 'absolute'});
85        subMenu.find('ul.sub-menu').css({'right': '-99999px'}).css({'position': 'absolute'});
86     }
87		   });
88
89		}
90
91		$('#navmain > div').on('click', function(e) {
92
93			e.stopPropagation();
94
95			// toggle main menu
96			if ( $(window).width() < 800 ) {
97
98				var parentOffset = $(this).parent().offset(); 
99				
100				var relY = e.pageY - parentOffset.top;
101			
102				if (relY < 36) {
103				
104					var firstChild = $('ul:first-child', this);
105
106        if (firstChild.css('right') == '-99999px')
107            firstChild.css({'right': 'auto'});
108        else
109            firstChild.css({'right': '-99999px'});
110
111        firstChild.parent().toggleClass('mobile-menu-expanded');
112				}
113			}
114		});
115
116		// re-init main menu on screen resize
117		$(window).on('resize', function () {
118	       
119	    	fdesign_mainMenuClear();
120	    	fdesign_mainMenuInit();
121		});
122
123		var unslider = $( '.slider' ).unslider({
124						speed: 500,               //  The speed to animate each slide (in milliseconds)
125						delay: 3000,              //  The delay between slide animations (in milliseconds)
126						complete: function() {},  //  A function that gets called after every slide animation
127						keys: true,               //  Enable keyboard (left, right) arrow shortcuts
128						dots: true,               //  Display dot navigation
129						fluid: true              //  Support responsive design. May break non-responsive designs
130					});
131	
132		$('.unslider-arrow').on('click', function() {
133				var fn = this.className.split(' ')[1];
134			
135				//  Either do unslider.data('unslider').next() or .prev() depending on the className
136				unslider.data('unslider')[fn]();
137				
138				unslider.data('unslider').stop();
139		});
140	});
141
142	function fdesign_mainMenuClear() {
143
144		if ( $(window).width() >= 800 ) {
145		
146			$('#navmain > div > ul > li').has('ul').removeClass('level-one-sub-menu');
147			$('#navmain > div > ul li ul li').has('ul').removeClass('level-two-sub-menu');										
148		}
149
150		if ( $('ul:first-child', $('#navmain > div') ).is( ":visible" ) ) {
151
152			$('ul:first-child', $('#navmain > div') ).css('display', '');
153		}
154	}
155
156	function fdesign_mainMenuInit() {
157
158		if ( $(window).width() >= 800 ) {
159		
160			$('#navmain > div > ul > li').has('ul').addClass('level-one-sub-menu');
161			$('#navmain > div > ul li ul li').has('ul').addClass('level-two-sub-menu');
162
163    // add support of browsers which don't support focus-within
164    $('#navmain > div > ul > li > a:not(.search-form-icon), #navmain > div > ul > li > ul > li > a, #navmain > div > ul > li > ul > li > ul > li > a')
165      .on('mouseenter focus', function() {
166        $(this).closest('li.level-one-sub-menu').addClass('menu-item-focused');
167        $(this).closest('li.level-two-sub-menu').addClass('menu-item-focused');
168
169        if (!$(this).parent().find('#cart-popup-content').length && $('#cart-popup-content').css('right') != '-99999px')
170          $('#cart-popup-content').css('right', '-99999px');
171      }).on('mouseleave blur', function() {
172        $(this).closest('li.level-one-sub-menu').removeClass('menu-item-focused');
173        $(this).closest('li.level-two-sub-menu').removeClass('menu-item-focused');
174    });										
175		}
176	}
177
178})(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.