Jquery mobile,如何手动更改“pagebeforeload”上的页面事件
我正在尝试使用文档中定义的方法重定向页面
$( document ).bind( "pagebeforeload", function( event, data ){
// Let the framework know we're going to handle the load.
event.preventDefault();
// ... load the document then insert it into the DOM ...
// at some point, either in this callback, or through
// some other async means, call resolve, passing in
// the following args, plus a jQuery collection object
// containing the DOM element for the page.
data.deferred.resolve( data.absUrl, data.options, page );
});
,但我不确定确切解析的参数是什么,我在任何地方都找不到文档,那里的页面参数到底是什么?
I'm trying to redirect a page using the method defined in the docs
$( document ).bind( "pagebeforeload", function( event, data ){
// Let the framework know we're going to handle the load.
event.preventDefault();
// ... load the document then insert it into the DOM ...
// at some point, either in this callback, or through
// some other async means, call resolve, passing in
// the following args, plus a jQuery collection object
// containing the DOM element for the page.
data.deferred.resolve( data.absUrl, data.options, page );
});
But I'm not sure what params exactly resolve is taking I can't find the docs anywhere, what exactly is the page param there?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我遇到了同样的问题,我最终所做的是创建一个隐藏按钮,然后触发该按钮上的单击事件。我知道这可能不是正确的方法,但我想我会提供一个解决方案/黑客。如果其他人有更好的东西,我真的很想听听。
JS
HTML
I had this same issue, what I ended up doing was creating a hidden button, then triggering a click event on that button. I know this is probably not the correct way to do it, but I thought I'd offer up a solution/hack. If anyone else has something better I would really like to hear about it.
JS
HTML
文档松散地引用了
page
对象在这里引用。所以我认为你会想要这样的东西:
这可能会回答你的问题,但可能对解决你的问题没有多大作用。有多种方法可以处理此问题,但以下是如何重定向到
pagechange
上的特定页面的示例:http://jsfiddle.net/BD9ax/希望这有助于解决您的问题。
The docs are referring to the
page
object loosely referred to here.So I think you would want something like this:
That may answer your question, but probably won't do much to solve your problem. There are several ways to handle this, but here is an example of how to redirect to a specific page on
pagechange
: http://jsfiddle.net/BD9ax/Hope this helps resolve your issue.
他们使用
page
来表示额外的参数。例如,这是 jQuery Mobile 1.3 的情况。
They are using
page
to denote that extra argument. e.g.This is with jQuery Mobile 1.3.