什么是“移动页面容器”?选择 [英] What is the "mobile-pagecontainer" selector

查看:255
本文介绍了什么是“移动页面容器”?选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jQuery Mobile有各种各样的事件和方法。 pagecontainer 事件和方法用于处理来自 v1.4的大部分事件。我不明白使用:mobile-pagecontainer 选择器。

jQuery Mobile has various events and methods. The pagecontainer events and methods are used to handle most of the page events from v1.4. I do not understand the use of the :mobile-pagecontainer selector.

API文档仅使用 $('。selector')虽然这很简单易懂,但我不知道它指的是哪个对象。我应该在 $('div [data-role =page]') $('body')上使用它。另一个选择器:mobile-pagecontainer ,表示什么?

The API documentation only uses $('.selector') which is straightforward and simple to understand though, I do not know which object it is referring to. Am I supposed to use it on a $('div[data-role="page"]') or on $('body'). And what does the other selector, :mobile-pagecontainer, signify?

API: jQuery 1.4.0 API

编辑:另外,我发现很多例子stackoverflow和其他网站使用 $(文件)所有这些的关系是什么?

Also, I found many examples on stackoverflow and other websites using $(document) what is the relation to all these?

编辑2:我创建了使用所有3个选择器显示 pagecontainerbeforeshow 事件的小小提琴 $('body') $(':mobile-pagecontainer') $(文件) 小提琴 - PageContainer活动。我的心感谢@Omar

Edit 2: I created a tiny fiddle which exhibits the pagecontainerbeforeshow event using all the 3 selectors $('body'), $(':mobile-pagecontainer') and $(document)Fiddle - PageContainer Events. My heart felt gratitude and thanks to @Omar

推荐答案

$(:mobile-pagecontainer)是一个选择器,它指的是jQM页面的 parent 元素,内部页面和外部 ones。

$(":mobile-pagecontainer") is a selector, it refers to the parent element of jQM pages, both internal pages and external ones.

默认情况下,:mobile-pagecontainer body 。它也可以称为 $ .mobile.pageContainer (在pageContainer中记住大写字母C)。

By default, :mobile-pagecontainer is body. It also can be referred to as $.mobile.pageContainer (mind capital "C" in pageContainer).

.pagecontainer()是一个用于更改加载页面以及检索的函数活动页面

.pagecontainer() is a function that is used to change and load pages, as well as retrieve active page.

简而言之, $(:mobile-pagecontainer) = $ .mobile.pageContainer = $(body)(默认)。

In short, $(":mobile-pagecontainer") = $.mobile.pageContainer = $("body") (default).

:mobile-pagecontainer 的值可以在 mobileinit 上覆盖,以防你想要换行与 body 不同的元素中的页面。

The value of :mobile-pagecontainer can be overridden on mobileinit, in case you want to wrap pages in a different element than body.

$(document).on("mobileinit", function () {
  $.mobile.pageContainer = $("#foo");
});




  • 更改页面(假设 foo 是容器):

    $("#foo").pagecontainer("change", "#pageID or URL");
    


  • 要加载外部页面:

    $("#foo").pagecontainer("load", "URL");
    


  • 要检索活动页面

    $("#foo").pagecontainer("getActivePage");
    


  • 这篇关于什么是“移动页面容器”?选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆