Responsive menu: fix calculation of the responsive trigger width from JS. It is affected by a vertical scrollbar width in some browsers. See #26458.
Built from https://develop.svn.wordpress.org/trunk@26743 git-svn-id: http://core.svn.wordpress.org/trunk@26632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8d82adf989
commit
2da2559d26
|
@ -184,12 +184,13 @@ $(document).ready( function() {
|
||||||
// reset any compensation for submenus near the bottom of the screen
|
// reset any compensation for submenus near the bottom of the screen
|
||||||
$('#adminmenu div.wp-submenu').css('margin-top', '');
|
$('#adminmenu div.wp-submenu').css('margin-top', '');
|
||||||
|
|
||||||
// WebKit excludes the width of the vertical scrollbar when applying the CSS "@media screen and (max-width: ...)"
|
if ( window.innerWidth ) {
|
||||||
// and matches $(window).width().
|
// window.innerWidth is affected by zooming on phones
|
||||||
// Firefox and IE > 8 include the scrollbar width, so after the jQuery normalization
|
respWidth = Math.max( window.innerWidth, document.documentElement.clientWidth );
|
||||||
// $(window).width() is 884px but window.innerWidth is 900px.
|
} else {
|
||||||
// (using window.innerWidth also excludes IE < 9)
|
// Exclude IE < 9, it doesn't support @media CSS rules
|
||||||
respWidth = navigator.userAgent.indexOf('AppleWebKit/') > -1 ? $(window).width() : window.innerWidth;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( respWidth && respWidth < 900 ) {
|
if ( respWidth && respWidth < 900 ) {
|
||||||
if ( body.hasClass('auto-fold') ) {
|
if ( body.hasClass('auto-fold') ) {
|
||||||
|
@ -603,7 +604,15 @@ $(document).ready( function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
trigger: function() {
|
trigger: function() {
|
||||||
var width = navigator.userAgent.indexOf('AppleWebKit/') > -1 ? $window.width() : window.innerWidth;
|
var width;
|
||||||
|
|
||||||
|
if ( window.innerWidth ) {
|
||||||
|
// window.innerWidth is affected by zooming on phones
|
||||||
|
width = Math.max( window.innerWidth, document.documentElement.clientWidth );
|
||||||
|
} else {
|
||||||
|
// Exclude IE < 9, it doesn't support @media CSS rules
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( width <= 782 ) {
|
if ( width <= 782 ) {
|
||||||
if ( ! wpResponsiveActive ) {
|
if ( ! wpResponsiveActive ) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue