Responsive menu: fix calculation of the responsive trigger width from JS. It is affected by a vertical scrollbar width in some browsers. See #26458.
git-svn-id: https://develop.svn.wordpress.org/trunk@26743 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
092ee69e61
commit
98b9246261
@ -184,12 +184,13 @@ $(document).ready( function() {
|
||||
// reset any compensation for submenus near the bottom of the screen
|
||||
$('#adminmenu div.wp-submenu').css('margin-top', '');
|
||||
|
||||
// WebKit excludes the width of the vertical scrollbar when applying the CSS "@media screen and (max-width: ...)"
|
||||
// and matches $(window).width().
|
||||
// Firefox and IE > 8 include the scrollbar width, so after the jQuery normalization
|
||||
// $(window).width() is 884px but window.innerWidth is 900px.
|
||||
// (using window.innerWidth also excludes IE < 9)
|
||||
respWidth = navigator.userAgent.indexOf('AppleWebKit/') > -1 ? $(window).width() : window.innerWidth;
|
||||
if ( window.innerWidth ) {
|
||||
// window.innerWidth is affected by zooming on phones
|
||||
respWidth = Math.max( window.innerWidth, document.documentElement.clientWidth );
|
||||
} else {
|
||||
// Exclude IE < 9, it doesn't support @media CSS rules
|
||||
return;
|
||||
}
|
||||
|
||||
if ( respWidth && respWidth < 900 ) {
|
||||
if ( body.hasClass('auto-fold') ) {
|
||||
@ -603,7 +604,15 @@ $(document).ready( 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 ( ! wpResponsiveActive ) {
|
||||
|
Loading…
Reference in New Issue
Block a user