Twenty Fifteen: unfix the sidebar if we have a menu with submenus as there is a chance visitors might not be able to scroll down to see submenus in some situations.
Props mattwiebe, fixes #30208. Built from https://develop.svn.wordpress.org/trunk@30324 git-svn-id: http://core.svn.wordpress.org/trunk@30323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
912cdc5978
commit
3f967c8f1a
|
@ -50,11 +50,6 @@
|
||||||
|
|
||||||
|
|
||||||
// Sidebar (un)fixing: fix when short, un-fix when scroll needed
|
// Sidebar (un)fixing: fix when short, un-fix when scroll needed
|
||||||
$body = $( 'body' );
|
|
||||||
$window = $( window );
|
|
||||||
sidebar = $( '#sidebar' )[0];
|
|
||||||
toolbarOffset = $body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0;
|
|
||||||
|
|
||||||
function fixedOrScrolledSidebar() {
|
function fixedOrScrolledSidebar() {
|
||||||
if ( $window.width() >= 955 ) {
|
if ( $window.width() >= 955 ) {
|
||||||
if ( sidebar.scrollHeight < ( $window.height() - toolbarOffset ) ) {
|
if ( sidebar.scrollHeight < ( $window.height() - toolbarOffset ) ) {
|
||||||
|
@ -78,6 +73,22 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
$window.on( 'load.twentyfifteen', fixedOrScrolledSidebar ).on( 'resize.twentyfifteen', debouncedFixedOrScrolledSidebar() );
|
|
||||||
|
$( document ).ready( function() {
|
||||||
|
// But! We only want to allow fixed sidebars when there are no submenus.
|
||||||
|
if ( $( '#site-navigation .sub-menu' ).length ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// only initialize 'em if we need 'em
|
||||||
|
$body = $( 'body' );
|
||||||
|
$window = $( window );
|
||||||
|
sidebar = $( '#sidebar' )[0];
|
||||||
|
toolbarOffset = $body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0;
|
||||||
|
|
||||||
|
$window
|
||||||
|
.on( 'load.twentyfifteen', fixedOrScrolledSidebar )
|
||||||
|
.on( 'resize.twentyfifteen', debouncedFixedOrScrolledSidebar() );
|
||||||
|
} );
|
||||||
|
|
||||||
} )( jQuery );
|
} )( jQuery );
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.1-alpha-30323';
|
$wp_version = '4.1-alpha-30324';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue