PageSourceSearch

https://service-forward.ru/wp-content/themes/i-max/js/functions.js?ver=2013-07-18

js service-forward.ru collected 2026-10-08 13:01:58 UTC 7,148 bytes, 302 lines download raw bytes

1/**
2 * Functionality specific to i-max.
3 *
4 * Provides helper functions to enhance the theme experience.
5 */
6
7( function( $ ) {
8	var body    = $( 'body' ),
9	    _window = $( window );
10	
11	/**
12	 * Enables menu toggle for small screens.
13	 */
14	( function() {
15		var nav = $( '#site-navigation' ), button, menu;
16		if ( ! nav )
17			return;
18
19		button = nav.find( '.menu-toggle' );
20		if ( ! button )
21			return;
22
23		// Hide button if menu is missing or empty.
24		menu = nav.find( '.nav-container' );
25		if ( ! menu || ! menu.children().length ) {
26			button.hide();
27			return;
28		}
29
30		$( '.menu-toggle' ).on( 'click.imax', function() {
31			//nav.toggleClass( 'toggled-on' );
32		} );
33	} )();
34
35	/**
36	 * Makes "skip to content" link work correctly in IE9 and Chrome for better
37	 * accessibility.
38	 *
39	 * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
40	 */
41	_window.on( 'hashchange.imax', function() {
42		var element = document.getElementById( location.hash.substring( 1 ) );
43
44		if ( element ) {
45			if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) )
46				element.tabIndex = -1;
47
48			element.focus();
49		}
50	} );
51
52		
53} )( jQuery );
54
55/* scripts to run on document ready */
56jQuery(document).ready(function($) {
57	
58	/* customizing the drop down menu */
59	jQuery('div.nav-container > ul > li > a').append( '<span class="colorbar"></span>' );
60    jQuery('div.nav-container ul > li').hover(function() {
61        jQuery(this).children('ul.children,ul.sub-menu').stop(true, true).slideDown("fast");
62    }, function(){
63        jQuery(this).children('ul.children,ul.sub-menu').slideUp("fast");
64    });
65	
66	jQuery('.search-form').append( '<span class="searchico genericon genericon-search"></span>' );
67	
68	
69	
70	/* adding class for no featured image posts */
71	$( "div.entry-nothumb" ).parent(".meta-img").addClass("no-image-meta");
72	
73	/* Go to top button */
74	jQuery('body').append('<a href="#" class="go-top animated"><span class="genericon genericon-collapse"></span></a>');
75                        // Show or hide the sticky footer button
76    jQuery(window).scroll(function() {
77        if (jQuery(this).scrollTop() > 200) {
78        	jQuery('.go-top').fadeIn(200).addClass( 'bounce' );
79        } else {
80            jQuery('.go-top').fadeOut("slow");
81        }
82    });
83
84
85    // Animate the scroll to top
86    jQuery('.go-top').click(function(event) {
87        event.preventDefault();
88        jQuery('html, body').animate({scrollTop: 0}, 1000);
89    });	
90	
91	
92	/* Side responsive menu	 */
93	$('.menu-toggle').sidr({
94      	name: 'sidr-left',
95      	side: 'left',
96		source: '.nav-container',
97			onOpen: function() {
98				$('.menu-toggle').animate({
99					marginLeft: "260px"
100				}, 200);
101			},
102			onClose: function() {
103				$('.menu-toggle').animate({
104					marginLeft: "0px"
105				}, 200);
106			}
107    });
108	
109	$(window).resize(function () {
110        if ($(window).width() > 1070) {
111            $.sidr('close', 'sidr-left');
112        }
113	  	equalheight('#ft-post article');
114    });	
115	
116	/*equal height for featured post for two column view */
117	
118	equalheight = function(container){
119	
120		var currentTallest = 0,
121			 currentRowStart = 0,
122			 rowDivs = new Array(),
123			 $el,
124			 topPosition = 0;
125		$(container).each(function() {
126		
127		   $el = $(this);
128		   $($el).height('auto')
129		   topPostion = $el.position().top;
130		
131		   	if (currentRowStart != topPostion) {
132				for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
133			   		rowDivs[currentDiv].height(currentTallest);
134			 	}
135			 	rowDivs.length = 0; // empty the array
136			 	currentRowStart = topPostion;
137			 	currentTallest = $el.height();
138			 	rowDivs.push($el);
139		   	} else {
140			 	rowDivs.push($el);
141			 	currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
142		  	}
143		   	for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
144			 	rowDivs[currentDiv].height(currentTallest);
145		   	}
146		});
147	}
148
149  	equalheight('.main article');
150	
151
152
153	/*
154	$(window).scroll(function(){
155		var newvalue = parseInt($(this).scrollTop()*0.25)-64;
156    	$('.ibanner').css('background-position', '0px '+newvalue+'px');
157	});
158	*/
159	
160	
161
162	$(window).load(function(){	
163		
164		// footer area masonry	
165		$('#footer-widgets').each(function () {
166			$(this).masonry({});
167		});
168		
169		// Two column Blog layout masonry
170		$('#blog-cols').each(function () {
171			$(this).masonry({});
172		});		
173		
174	});		
175	
176	
177	// slider
178	$('#da-slider').each(function() {
179		
180		_this = $(this);
181		var slider_speed = _this.data('slider-speed');
182	
183		_this.owlCarousel({
184	 		
185			navigation : true,
186			autoPlay : slider_speed,
187			paginationSpeed : 600,
188			singleItem: true,
189			rewindSpeed: 600,
190			stopOnHover: true,
191			navigationText: ['<span class="genericon genericon-leftarrow"></span>','<span class="genericon genericon-rightarrow"></span>'],
192			addClassActive: true,
193			theme : "owl-theme1",
194			goToFirstSpeed : 1000,
195			slideSpeed : 600,
196			autoHeight: true			
197
198	 
199		});
200	 
201	});
202
203	// Banner Parallax Effect
204	if ( $('.ibanner').length > 0 )
205	{			
206	
207		var slider_parallax = $('#da-slider').data('slider-parallax');
208		
209		if (slider_parallax == 1)
210		{		
211			var slidetop = parseInt($('.ibanner').offset().top);
212			
213			if( $( window ).width() > 999 )
214			{	
215				$(window).scroll(function(){
216					//var newvalue = parseInt($(this).scrollTop()*0.25)-64;
217					var newvalue = parseInt($(this).scrollTop()*0.70)-100;
218					
219					if ($(this).scrollTop() > slidetop)
220					{
221						$('.da-img img').css('margin-top', newvalue+'px');
222					}
223					
224					if ($(this).scrollTop() <= slidetop)
225					{
226						var slideheight = $('.active .da-img img').height();
227						$('.da-img img').css('margin-top', 0+'px');
228						$('.owl-wrapper-outer').css('max-height', slideheight+'px');
229					}		
230					//console.log('margin-top : '+newvalue+'px, ' + 'SlideTop : ' +slidetop+'px, ' + 'Scrolltop : ' +$(this).scrollTop()+'px');
231				});
232			}
233		}
234	}
235	/**/
236	
237});
238
239/* scripts to run as loads */
240
241(function($) {
242	
243	/* acrolling header */
244	var nav_container = $(".headerwrap");
245	var nav = $(".site-header");
246
247	var top_spacing = 30;
248	var waypoint_offset = 60;
249	
250	if( $( window ).width() > 999 )
251	{
252		if ( $(".admin-bar").length>0 )
253		{
254			if($( window ).width()<766)
255			{
256				var top_spacing = 0;
257			} else
258			{
259				var top_spacing = 30;
260			}
261		} else
262		{
263			var top_spacing = 0;
264		}
265		nav_container.waypoint({
266			handler: function(direction) {
267				
268				if (direction == 'down') {
269					nav_container.css({ 'height':nav.outerHeight() });		
270					nav.stop().addClass("fixeddiv").css("top",-nav.outerHeight()).animate({"top":top_spacing});
271				} else {
272				
273					nav_container.css({ 'height':'auto' });
274					nav.stop().removeClass("fixeddiv").css("top",nav.outerHeight()).animate({"top":""});
275				}
276				
277			},
278			offset: function() {
279				return -nav.outerHeight()-waypoint_offset;
280			}
281		});
282	}
283
284	/* no utility bar class addition */
285	if ( $('.utilitybar').length == 0 )
286	{
287		$('.headerwrap').addClass('noutility');
288	}
289	
290})(jQuery);
291
292jQuery(document).ready(function($) {
293	$(window).load(function(){	
294		// hide the preloader
295		if ( $( 'body' ).hasClass( 'nx-preloader' ))
296		{					
297			$( '.nx-preloader .nx-ispload' ).css( "display", "none" );
298		}
299	});
300});		
301/**/
302/**/

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.