1

我正在使用 jQuery Mobile 开发我的第一个应用程序,但我遇到了一个问题(在网络上没有找到任何东西)。我正在使用 3 页的导航栏。

第一页显示了一些维基百科的内容iframe(记住它)!当我单击第二页 (Approvondimenti) 时,它会显示一个垂直菜单,其中包含一些我可以单击的元素。

我的 jQuery 函数的作用(通过单击第二页中的一个菜单元素)是将 iframe 'src' 更改为新 URL ...但我不知道如何使用我的返回到第一页功能,因此我的应用程序可以显示 URL 更改(不希望手动单击第一页来加载iframe内容)。

你能帮助我吗?

这是我的功能:

$(document).on('click', '.a', function(e){ // here i already am in the second page
       var appr=$(this).attr('id'); //here i get the URL from second page, i stored them in the elements id
   $('#iframe').attr('src',appr); //here i set new URL 
       //HERE WHAT TO DO????????
    });

在此处输入图像描述

4

1 回答 1

2

添加这个以在 jQuery 移动中更改页面:

 $.mobile.changePage("#page1");

链接:http: //jsfiddle.net/androdify/q2LJX/9/

于 2013-07-08T19:11:20.250 回答