【问题标题】:Setting a fixed position to a DIV[not a footer or header] in jQuery Mobile doesn't work as intended在 jQuery Mobile 中将固定位置设置为 DIV [不是页脚或页眉] 无法按预期工作
【发布时间】:2012-06-14 14:14:38
【问题描述】:

我希望在 jQuery Mobile 中为 div 设置一个固定位置,我知道如何通过添加数据属性 data-position="fixed" 来使标题成为可能。我试图实现的是为既不是页眉也不是页脚的 DIV 设置固定位置,这可能吗?

我以为我可以使用下面的代码来实现它,但它没有。DIV 甚至不渲染

<div id="messageBox" data-position="fixed">
</div>

【问题讨论】:

  • 通过阅读 jQuery Mobile 文档,jQm 似乎并不支持本机。您是否尝试过直接使用 CSS?位置:绝对;顶部:##px; ?需要查看更多代码才能知道这是否实用。
  • 我已经遇到了 iOS 键盘/输入上滑问题,这些问题会破坏我的固定页脚......所以如果这已经是个问题,我怀疑你会有很多成功的位置:固定非页脚/页眉元素。

标签: jquery-mobile


【解决方案1】:

目前仅支持&lt;header data-role="header" data-position="fixed"&gt;&lt;footer data-role="footer" data-position="fixed"&gt;

由于您想要一个fixed div,您可能知道要修复它与顶部/底部的距离。也许您可以使用页眉/页脚并通过设置与顶部/底部相关的边距来修改 CSS 以满足您的需求。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-10-30
    • 2022-11-13
    • 2013-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-06
    相关资源
    最近更新 更多