javascript - jQuery Mobile 加载错误

标签 javascript jquery html jquery-mobile

我正在尝试使用 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/

相关文章:

javascript - 如何在 JS 中将毫秒转换为日期?

javascript - jQuery 音频 : How to Allow Overlapping Sounds?

javascript - jQuery 克隆和递增输入、文本区域,具有名称、id 和 for

html - Sass 编译并对更改的内容创建注释

javascript - div 拖在一起而不是分开

javascript - 获取文本框的值

javascript - Ember 过渡和渲染完成事件

javascript - 如何结合 jQuery UI 对话框标题更改和在一个函数调用中打开

javascript - 从单个 HTTP 请求生成多个 HTTP 请求 Angular 2

jQuery Keydown 事件在 Chrome 中不起作用