在 jquery.mobile-X.X.X.js 文件中找到这个函数,并将最小高度设置为“100%”,如下所示。我发现当它认为面板不适合页面时,它正在尝试更改页面的最小高度,但这样做有时会弄乱您预设的页面大小并导致双垂直滚动条...因此在函数中将其设置为 100% 将使您的页面保持不变,即使 jquery 尝试调整大小(如果您尚未使用 100% 的页面高度,请将其设置为您使用的大小)。
//simply set the active page's minimum height to screen height, depending on orientation
resetActivePageHeight: function( height ) {
var page = $( "." + $.mobile.activePageClass ),
pageHeight = page.height(),
pageOuterHeight = page.outerHeight( true );
height = compensateToolbars( page,
( typeof height === "number" ) ? height : $.mobile.getScreenHeight() );
// Remove any previous min-height setting
page.css( "min-height", "" );
// Set the minimum height only if the height as determined by CSS is insufficient
if ( page.height() < height ) {
page.css( "min-height", "100%" );
}
},
如果您使用的是 jquery.mobile-X.X.X.min.js,这里是您需要更改的功能:
resetActivePageHeight:function(b){var c=a("."+a.mobile.activePageClass),e=c.height(),f=c.outerHeight(!0);b=d(c,"number"==typeof b?b:a.mobile.getScreenHeight()),c.css("min-height",""),c.height()<b&&c.css("min-height","100%")},