最大化 jQueryMobile 中内容 div 的大小

发布于 2024-09-28 16:16:56 字数 549 浏览 0 评论 0原文

如何最大化扮演“内容”角色的div的大小?

我认识到这可能只是一个基本的 CSS 问题,但感觉它与 jQueryMobile 中的 CSS 相关。

我将 Google 地图放置在内容 div 中,并且希望地图能够填充移动浏览器上的可用垂直空间。相反,它的固定大小约为 10px(给定或取取)。

<div data-role="page">
 <div data-role="header" class="ui-header ui-bar-a">Header</div>
 <div data-role="content" class="ui-body ui-content">
  <div id="divMap">google map via javascript</div>
 </div>
 <div data-role="footer">footer</div>

在这种情况下,jQueryMobile 始终为其内容创建最小大小,并且我始终希望它是可用页面的 80%。

How can I maximize the size of the div that plays the role of "content"?

I recognize that this may simply be a basic CSS question, but it feels like it is tied to CSS in jQueryMobile.

I'm placing a Google Map in the content div and I'd like the map to fill the available verticle space on the mobile browser. Instead, it's a fixed size of about 10px (give or take).

<div data-role="page">
 <div data-role="header" class="ui-header ui-bar-a">Header</div>
 <div data-role="content" class="ui-body ui-content">
  <div id="divMap">google map via javascript</div>
 </div>
 <div data-role="footer">footer</div>

In this case, jQueryMobile always creates the minimal size for its contents, and I always want it to be 80% of the available page.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光与爱终年不遇 2024-10-05 16:16:57

您可能可以使用 jQuery(不过,我没有使用过 jQuery mobile,所以这可能无法直接工作):

$(document).ready(
  function(){
    $('#content').height($(window).height()*0.8);
  }
);

JS Fiddle demo

You could probably use jQuery (I haven't worked with jQuery mobile, though, so this might not work directly):

$(document).ready(
  function(){
    $('#content').height($(window).height()*0.8);
  }
);

JS Fiddle demo

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文