jQuery Mobile changePage()在Windows Phone中不工作 [英] jQuery Mobile changePage() not working in Windows Phone
问题描述
我正在使用Phonegap为Windows Phone 8开发应用程序。
I am developing an application using Phonegap for Windows Phone 8.
我使用jQuery Mobile进行界面设计。
I've used jQuery Mobile for interface design.
$。mobile.changePage()
无法使用。该页面未更改。
the $.mobile.changePage()
is not working. The page is not being changed.
有没有其他方法来更改页面?有没有其他框架来设计移动界面?
Is there any other way to change the page? Is there any other framework to design the interface for mobile?
$("#btnSearch").bind('click', function() {
showSpinner();
$.mobile.changePage("#pageSearch");
});
推荐答案
我认为这个问题与WP7 此处。
I think this problem is the same as in WP7 described here.
检查路径问题:
if($.mobile.path.getLocation("x-wmapp1:/app/www/index.html") != "x-wmapp1:/app/www/index.html")
{
console.log('there is path problem');
}
else
{
console.log('everything is OK with paths');
}
解决方案:
如github中所述,WP7的问题是路径与其他平台不同。基本上在WP7上,getLocation以双斜线打印相对路径,这首先导致了这个问题。要解决此问题,请打开 jquery.mobile-1.3.1.js 并重构以下内容:
As described in github, problem is path on WP7 differs from other platforms. Basically on WP7 getLocation prints relative paths with double slashes, which causes this issue at first place. To fix, open jquery.mobile-1.3.1.js and refactor following:
- var uri = url ? this.parseUrl( url ) : location,
- hash = this.parseUrl( url || location.href ).hash;
+ var uri = this.parseUrl( url || location.href ),
+ hash = uri.hash;
和:
- return uri.protocol + "//" + uri.host + uri.pathname + uri.search + hash;
+ return uri.protocol + uri.doubleSlash + uri.host + uri.pathname + uri.search + hash;
进行此更改后,检查应显示一切正常。
After making this changes, check should display "everything is OK".
PS这是在WP7测试,完全固定我的问题与$ .mobile.changePage()。
PS This is tested on WP7 and totally fixed my issue with $.mobile.changePage().
PS2这个问题在github修复jQuery的版本,虽然我刚刚检查最新的稳定版本(
PS2 This issue is fixed at github version of jQuery, although I've just checked latest stable version(1.3.2) and unfortunately it is NOT fixed there.
请注意,
Hristo Todorov
Hristo Todorov
这篇关于jQuery Mobile changePage()在Windows Phone中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!