Javascript jQuery中的Mobile.changepage不工作(白色屏幕)
我使用html css和js在eclipse上构建我的phonegap项目,我在js文件中包含了我的jquery和jquery移动库以使用mobile.changepage函数,但它一直给我白色屏幕,然后返回到同一页面(没有变化发生) 这是我的档案:Javascript jQuery中的Mobile.changepage不工作(白色屏幕),javascript,jquery,html,eclipse,cordova,Javascript,Jquery,Html,Eclipse,Cordova,我使用html css和js在eclipse上构建我的phonegap项目,我在js文件中包含了我的jquery和jquery移动库以使用mobile.changepage函数,但它一直给我白色屏幕,然后返回到同一页面(没有变化发生) 这是我的档案: document.addEventListener('touchmove',函数(e){ e、 预防默认值(); },假); document.getElementById(“Golds”).addEventListener('touchstar
document.addEventListener('touchmove',函数(e){
e、 预防默认值();
},假);
document.getElementById(“Golds”).addEventListener('touchstart',function(){
警报(“omar”);
$.mobile.changePage('login.html');
});
document.getElementById(“Titans”).addEventListener('touchstart',function(){
$.mobile.changePage(“login.html”);
});
//结束登录表单//
电话缺口试验
训练与比赛
黄金健身房
泰坦体育馆
智能健身房
萨米娅阿鲁巴
纤维健身房
你的js代码在哪里?哪个文件?如果是index.js,请将脚本标记移到jquery移动脚本标记下方。很抱歉,我不明白您要我做什么??请参阅下面的答案。当事件监听器通过普通javascript添加并附加到文档中时,您的代码仍然可以工作。不确定脚本序列是否确实存在问题(如下所述)
<!DOCTYPE html>
<html>
<head>
<title>Phone Gap trial</title>
<link rel= 'stylesheet' href='css/bootstrap.css' />
<link rel= 'stylesheet' href='css/font-awesome.min.css' />
<link rel= 'stylesheet' href='css/style.css' />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
</head>
<body>
<div class="ourteam text-center">
<!--start container-->
<div class="team">
<section class="header">
<div>
<h1>Train & Game</h1>
</div>
</section>
<div class="container">
<div class="row">
<div class="col-xs-4">
<div class="person">
<img id="Golds" class="teamphotos img-circle" src="img\golds-gym-logo.png"/>
<h6>Gold's Gym</h6>
</div>
</div>
<div class="col-xs-4">
<div class="person">
<img id="Titans" class="teamphotos img-circle" src="img\Titans.jpg"/>
<h6>Titans Gym</h6>
</div>
</div>
<div class="col-xs-4">
<div class="person">
<img id="Smart" class="teamphotos img-circle" src="img\smart.png"/>
<h6>Smart Gym</h6>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-xs-6">
<div class="person">
<img id="SamiaAllouba" class="teamphotos img-circle" src="img\Samia-Allouba.jpg"/>
<h6>Samia Allouba</h6>
</div>
</div>
<div class="col-xs-6">
<div class="person">
<img class="teamphotos img-circle" src="img\fibers.jpg"/>
<h6>Fibers Gym</h6>
</div>
</div>
</div>
</div>
<!--end container-->
</div>
<!--end team-->
</div>
<!--Our team div end-->
<!--<script src="js/index.js"></script>--> <!-- Commented this Line in your code -->
<script src="js/jquery-2.1.4.min.js"> </script>
<script src="js/jquery.mobile-1.4.5.min.js"> </script>
<script src="js/bootstrap.min.js"> </script>
<script src="js/index.js"></script> <!-- Added this line -->
</body>
</html>
$(document).on('touchmove', function(e) {
e.preventDefault();
}, false);
$("#Golds").on('touchstart', function(){
alert("omar");
$.mobile.changePage('login.html');
});
$("#Titans").on('touchstart', function(){
$.mobile.changePage("login.html");
});