简体   繁体   English

jQuery Mobile应用程序如何重新启动

[英]jQuery Mobile app how to reinitiate

This is possible a very silly question, but I'm learning as I go. 这可能是一个非常愚蠢的问题,但是我正在学习。 I developed a simple single page jQuery Mobile/PhoneGap app using Intel XDK that create a Map, place a marker in the current location. 我使用Intel XDK开发了一个简单的单页jQuery Mobile / PhoneGap应用程序,该应用程序创建地图,将标记放置在当前位置。 Then it allows to to add markers, calculate route, distance,etc. 然后它允许添加标记,计算路线,距离等。 All that works perfectly. 所有这些都完美运行。 But, now, how do I "restart/ reset" the app so it goes to "initial state"? 但是,现在,我如何“重启/重置”应用程序,使其进入“初始状态”? Using Google Maps's documentation, I was able to delete the markers, etc. But I can't figure out how to go back to the beginning. 使用Google Maps的文档,我可以删除标记等。但是我不知道如何重新开始。 I added a button that when clicked triggers a function: 我添加了一个按钮,单击该按钮可触发功能:

function reStartPage() {
//location.reload();
//navigator.app.exitApp();
}

When I try location.reload(), the app reloads indeed, but the pages blinks as expected. 当我尝试location.reload()时,应用确实会重新加载,但是页面按预期闪烁。 On the other hand when I use navigator.app.exitApp(), it "kills" the application, but it doesn't re-initiate it. 另一方面,当我使用navigator.app.exitApp()时,它会“杀死”该应用程序,但不会重新启动它。 What options do I have? 我有什么选择?

Somewhere someone suggested something like: 在某处有人建议类似:

$.mobile.loadPage("#home", {
allowSamePageTransition : true,
transition : 'slide',
changeHash : true,
reloadPage : true
 });

$.mobile.changePage("#home", {
allowSamePageTransition : true,
transition : 'slide',
 changeHash : true,
reloadPage : true
});

But that doesn't work either. 但这也不起作用。 Please let me know if more details are needed. 请让我知道是否需要更多详细信息。 Thanks! 谢谢!

您可以尝试使用以下方法刷新地图:

google.maps.event.trigger(my_map, 'resize');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM