我正在尝试使用 jQuery 制作移动应用程序。我正在用来制作一个滑动面板,并且我有它的来源。来源是 .html .css 和 .js html 和 css 似乎可以工作,但 .js 不能。有答案吗?
它应该看起来像这样 this
它也在我的本地网络服务器上。
源代码:
.js
$(document).on("pageinit", "#demo-page", function () {
$(document).on("swipeleft swiperight", "#demo-page", function (e) {
// We check if there is no open panel on the page because otherwise
// a swipe to close the left panel would also open the right panel (and v.v.).
// We do this by checking the data that the framework stores on the page element (panel: open).
if ($.mobile.activePage.jqmData("panel") !== "open") {
if (e.type === "swipeleft") {
$("#right-panel").panel("open");
}
else if (e.type === "swiperight") {
$("#left-panel").panel("open");
}
}
});
});
最佳答案
您需要按以下顺序加载 JS 文件:
<script src="jquery.js"></script>
<script src="custom-scripting.js"></script>
<script src="jquery-mobile.js"></script>
引用:http://jquerymobile.com/demos/1.0/docs/api/globalconfig.html
关于javascript - jQuery Mobile 加载错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18426545/