-
Notifications
You must be signed in to change notification settings - Fork 284
/
genesis-sample.js
59 lines (49 loc) · 1.21 KB
/
genesis-sample.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* Genesis Sample entry point.
*
* @package GenesisSample\JS
* @author StudioPress
* @license GPL-2.0-or-later
*/
var genesisSample = ( function( $ ) {
'use strict';
/**
* Adjust site inner margin top to compensate for sticky header height.
*
* @since 2.6.0
*/
var moveContentBelowFixedHeader = function() {
var siteInnerMarginTop = 0;
if( $('.site-header').css('position') === 'fixed' ) {
siteInnerMarginTop = $('.site-header').outerHeight();
}
$('.site-inner').css('margin-top', siteInnerMarginTop);
},
/**
* Initialize Genesis Sample.
*
* Internal functions to execute on full page load.
*
* @since 2.6.0
*/
load = function() {
moveContentBelowFixedHeader();
$( window ).resize(function() {
moveContentBelowFixedHeader();
});
// Run after the Customizer updates.
// 1.5s delay is to allow logo area reflow.
if (typeof wp != "undefined" && typeof wp.customize != "undefined") {
wp.customize.bind( 'change', function ( setting ) {
setTimeout(function() {
moveContentBelowFixedHeader();
}, 1500);
});
}
};
// Expose the load and ready functions.
return {
load: load
};
})( jQuery );
jQuery( window ).on( 'load', genesisSample.load );