【发布时间】:2019-04-08 16:36:12
【问题描述】:
如果不将 [javascript file.js] 标记添加到我的代码标题中,我的 jquery 移动页面就会显示出来。但是,当我将标签添加到标题中时,我的页面只显示一个空白并且不显示任何信息。
我做错了什么?
我已经尝试在 jquery 移动插件之前、之后添加标签等,但它显示的页面没有我的 jquery 主题的皮肤。
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=yes">
<link rel="stylesheet" href="css/themes/blue.min.css" />
<link rel="stylesheet" href="css/themes/jquery.mobile.icons.min.css" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile.structure-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script src="images.js"></script>
<title>House 1</title>
</head>
Javascript 文件
$(document).ready(function () {
var i = 0;
var imgURL = [];
imgURL.push('pictures/houses/house1/image1.PNG');
imgURL.push('pictures/houses/house1/image2.PNG');
$("#house1").swiperight(function () {
if (i < (imgURL.length - 1)) {
i++
} else {
i = 0;
}
var imgStr = "<img src=" + imgURL[i] + " style='width:100%'>";
$('#popupImg').html(imgStr);
});
$("#house1").swipeleft(function () {
if (i > 0) {
i--
} else {
i = (imgURL.length - 1);
}
var imgStr = "<img src=" + imgURL[i] + " style='width:100%'>";
$('#popupImg').html(imgStr);
});
});
页面应该能够正常查看,而不是显示空白页面。
【问题讨论】:
-
您是在 jQuery.js 和插件之后放置脚本标签吗?秩序很重要。浏览器开发工具控制台中会抛出哪些错误?
-
我现在设法解决了这个问题,出于某种奇怪的原因,它以前对我不起作用,但现在它显示了我的页面。感谢您的帮助
-
建议你删除这个问题。它对任何人都没有未来价值
-
是的,我正在尝试删除它,但正在苦苦挣扎
标签: javascript css jquery-mobile