PageSourceSearch

https://lamuse.nl/wp-content/themes/fitmore/js/functions.js?ver=2014-02-01

js lamuse.nl collected 2026-09-26 11:24:43 UTC 3,007 bytes, 100 lines download raw bytes

1/**
2 * Theme functions file
3 *
4 * Contains handlers for navigation, accessibility, header sizing
5 * footer widgets and Featured Content slider
6 *
7 */
8( function( $ ) {
9	"use strict";
10	var body    = $( 'body' ),
11		_window = $( window );
12	// Enable menu toggle for small screens.
13	( function() {
14		var nav = $( '#site-navigation' ), button, menu;
15		if ( ! nav ) {
16			return;
17		}
18		button = nav.find( '.menu-toggle' );
19		if ( ! button ) {
20			return;
21		}
22		// Hide button if menu is missing or empty.
23		menu = nav.find( '.mega-menu' );
24		if ( ! menu || ! menu.children().length ) {
25			button.hide();
26			return;
27		}
28	} )();
29	/*
30	 * Makes "skip to content" link work correctly in IE9 and Chrome for better
31	 * accessibility.
32	 *
33	 * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
34	 */
35	_window.on( 'hashchange.templatemela', function() {
36		var element = document.getElementById( location.hash.substring( 1 ) );
37		if ( element ) {
38			if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {
39				element.tabIndex = -1;
40			}
41			element.focus();
42			// Repositions the window on jump-to-anchor to account for header height.
43			window.scrollBy( 0, -80 );
44		}
45	} );
46	$( function() {
47		"use strict";
48		/*
49		 * Fixed header for large screen.
50		 * If the header becomes more than 48px tall, unfix the header.
51		 *
52		 * The callback on the scroll event is only added if there is a header
53		 * image and we are not on mobile.
54		 */
55		if ( _window.width() > 781 ) {
56			var mastheadHeight = $( '#masthead' ).height(),
57				toolbarOffset, mastheadOffset;
58			if ( mastheadHeight > 48 ) {
59				body.removeClass( 'masthead-fixed' );
60			}
61			if ( body.is( '.header-image' ) ) {
62				toolbarOffset  = body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0;
63				mastheadOffset = $( '#masthead' ).offset().top - toolbarOffset;
64				_window.on( 'scroll.templatemela', function() {
65					if ( ( window.scrollY > mastheadOffset ) && ( mastheadHeight < 49 ) ) {
66						body.addClass( 'masthead-fixed' );
67					} else {
68						body.removeClass( 'masthead-fixed' );
69					}
70				} );
71			}
72		}
73		// Focus styles for menus.
74		$( '.primary-navigation, .secondary-navigation' ).find( 'a' ).on( 'focus.templatemela blur.templatemela', function() {
75			$( this ).parents().toggleClass( 'focus' );
76		} );
77	} );
78	// Arrange footer widgets vertically.
79	if ( $.isFunction( $.fn.masonry ) ) {
80		$( '#footer-sidebar' ).masonry( {
81			itemSelector: '.widget',
82			columnWidth: function( containerWidth ) {
83				return containerWidth / 4;
84			},
85			gutterWidth: 0,
86			isResizable: true,
87			isRTL: $( 'body' ).is( '.rtl' )
88		} );
89	}
90	// Initialize Featured Content slider.
91	_window.load( function() {
92		"use strict";
93		if ( body.is( '.slider' ) ) {
94			$( '.featured-content' ).featuredslider( {
95				selector: '.featured-content-inner > article',
96				controlsContainer: '.featured-content'
97			} );
98		}
99	} );
100} )( 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.