mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-04 06:37:06 +00:00
Themes: Remove jQuery dependency from wp-custom-header.js.
In [38985], we used jQuery to trigger a custom event once a video handler has completed so themes, like Twenty Fourteen, can execute their own adjustments after the header video has loaded. This replaces the jQuery `trigger()` method with a native event and updates Twenty Fourteen accordingly. Props adamsilverstein, joemcgill. Fixes #38550. git-svn-id: https://develop.svn.wordpress.org/trunk@39102 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -105,11 +105,6 @@
|
||||
|
||||
if ( body.is( '.header-image' ) ) {
|
||||
|
||||
// Recaculate the header height when a custom header loads.
|
||||
$( 'body' ).on( 'wp-custom-header-video-loaded', function() {
|
||||
mastheadOffset = $( '#site-header' ).height();
|
||||
} );
|
||||
|
||||
_window.on( 'scroll.twentyfourteen', function() {
|
||||
if ( _window.scrollTop() > mastheadOffset && mastheadHeight < 49 ) {
|
||||
body.addClass( 'masthead-fixed' );
|
||||
@@ -118,6 +113,12 @@
|
||||
}
|
||||
} );
|
||||
|
||||
// Update masthead offset once a custom header video loads.
|
||||
$( document ).on( 'wp-custom-header-video-loaded', function() {
|
||||
mastheadOffset = $( '#site-header' ).height();
|
||||
} );
|
||||
|
||||
|
||||
// Update masthead offset after a selective refresh.
|
||||
if ( 'undefined' !== typeof wp && wp.customize && wp.customize.selectiveRefresh ) {
|
||||
wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function() {
|
||||
|
||||
Reference in New Issue
Block a user