jQuery 移动数据页='内容'仅过渡

发布于 2024-12-25 16:15:12 字数 249 浏览 0 评论 0原文

我正在尝试使用 PhoneGap 和 jQuery Mobile 开发 iPhone 应用程序。此应用程序有一个固定页脚

我现在面临的主要问题是内置页面转换更改了整个页面,要求我在每个页面中复制/粘贴页脚代码。

显然,这不是这样做的方法。页脚中的任何微小更改都必须重复 10 次以上(对于 10 多个页面)。

我的问题如下:如何加载页面的“内容”部分(带有幻灯片过渡),这样我就不必在所有页面中添加页脚代码?

I am trying to develop an iPhone app using PhoneGap and jQuery Mobile. This app has a Fixed Footer.

The main problem I'm facing right now is that the built-in page transition changes THE WHOLE PAGE, requiring me to copy/paste the footer code in every page.

Obviously, this is not the way to do it. Any small change in the footer has to be duplicated 10+ times (for 10+ pages).

My question is as follows: how can I load just the "content" part of the page (with a slide transition) so I wont have to have to footer code in all of my pages?

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

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

发布评论

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

评论(2

生寂 2025-01-01 16:15:12

该功能在 jQuery Mobile 中尚不可用。您可以在 iOS 5 设备上为“真实”固定页脚和固定页眉打开 touchOverflowEnabled 选项,但不能为任何其他设备打开。

为了实现真正的固定工具栏,浏览器需要
支持位置:固定或溢出:自动。幸运的是,这种支持是
来到移动平台,这样我们就可以通过网络标准来实现这一点。
在 jQuery Mobile 中,我们添加了一个全局功能,称为
touchOverflowEnabled利用overflow:auto CSS属性
支持iOS5等平台。启用后,框架会包装每个
容器中的页面具有自己的内部滚动。这让我们
将工具栏定位在滚动主体之外,以便它们真正停留在
始终固定到位。

来源:http://jquerymobile.com/demos/1.0/docs/toolbars/bars -fixed.html

但是,您可以以编程方式设置页脚,而不是对每个页面进行硬编码:

//bind an event handler to the `pagecreate` event for all `data-role="page"` elements
$(document).delegate('[data-role="page"]', 'pagecreate', function () {

    //append a footer to this page (`pagecreate` is only called once per page added to the DOM so you don't have to worry about appending multiple footers to a single page
    $(this).append('<div data-id="my-fixed-footer" data-position="fixed" data-role="footer">{THE HTML FOR YOUR FOOTER GOES HERE}</div>');
});

这是一个演示:http://jsfiddle.net/vNqaG/ (请注意,HTML 窗格中没有硬编码的页脚)

That functionality is not yet available in jQuery Mobile. You can turn on the touchOverflowEnabled option for "real" fixed-footers and fixed-headers on iOS 5 devices but not for any other devices.

In order to achieve true fixed toolbars, a browser needs to either
support position:fixed or overflow:auto. Fortunately, this support is
coming to mobile platforms so we can achieve this with web standards.
In jQuery Mobile, we have added a global feature called
touchOverflowEnabled that leverages the overflow:auto CSS property on
supported platforms like iOS5. When enabled, the framework wraps each
page in a container with it's own internal scrolling. This allows us
to position the toolbars outside the scrolling body so they truly stay
fixed in place at all times.

Source: http://jquerymobile.com/demos/1.0/docs/toolbars/bars-fixed.html

You can however setup your footers in a programmatic manor rather than hard-coding each page:

//bind an event handler to the `pagecreate` event for all `data-role="page"` elements
$(document).delegate('[data-role="page"]', 'pagecreate', function () {

    //append a footer to this page (`pagecreate` is only called once per page added to the DOM so you don't have to worry about appending multiple footers to a single page
    $(this).append('<div data-id="my-fixed-footer" data-position="fixed" data-role="footer">{THE HTML FOR YOUR FOOTER GOES HERE}</div>');
});

Here is a demo: http://jsfiddle.net/vNqaG/ (Notice there are no hard-coded footers in the HTML pane)

醉态萌生 2025-01-01 16:15:12

如果您在 Web 应用程序中使用数据库,则只需将页脚 html 添加到数据库中,并在每个页面上使用 PHP 加载它即可。首先,您必须将 PHP 硬编码到每个页面中,但之后更改页脚只需快速编辑数据库即可。查找 MySQL/PHP。

If you're using a database in the web application, you can simply add the footer html into the database and load it with PHP every page. You'd have to hard-code the PHP into every page at first, but after that all it takes to change the footer is just a quick editing of the database. Look up MySQL/PHP.

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