[英]Javascript identify whether the browser platform is desktop or mobile(may be/not from device width-height)
[英]jquery mobile: set width and height for desktop browser
我正在使用jquery mobile来模拟iphone应用程序,并且在桌面浏览器上出现内容宽度和高度问题。 宽度问题可以通过这种方式解决(宽度= 320px,内容居中对齐):
html { background-color: #333; } @media only screen and (min-width: 321px){ .ui-page { width: 320px !important; margin: 0 auto !important; position: relative !important; } }但这会导致页脚下无用的背景。 我猜想可以替换ui页面的背景,并且可以为内容添加额外的div背景(在页眉和页脚之间),但是应该有更好的方法。
因此,问题是在桌面浏览器中打开内容时如何设置内容的宽度和高度?
更新:这是示例 。
您可以尝试删除页面元素的背景并将其设置为内容。 这是一个示例代码:
的CSS
.ui-page.ui-body-c {
background: none transparent;
}
.ui-content {
background: #f0f0f0;
}
您可以使用JavaScript来调整页面加载时.ui页面的高度-这是一个jQuery示例:
$(document).ready(function(){
if($(window).height() >= 480)
{
$('.iu-page').height(480);
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.