滑动以更改页面 - 不同的域

Swipe to change page - different domain

本文关键字:      更新时间:2023-09-26

我已经看到很多关于移动滑动按钮的帖子,但这些帖子总是关于在同一页面或同一域上的另一个页面上加载div。我正在尝试做几乎相同的事情,但要做不同的领域。这就是我所拥有的

http://jsfiddle.net/yxzZf/3898/

$("#listitem").swiperight(function() {
    $.mobile.changePage("http://www.google.com");
});$("#listitem").swipeleft(function() {
    $.mobile.changePage("http://www.google.com");
});

如您所见,当您滑动按钮时,它不会加载另一个域,它只是坐在那里,带有"我正在尝试min,我正在尝试"图标,没有其他任何事情发生。我根本不经常使用 jquery,也找不到 $.mobile.changePage 的替代品来加载不同的域。有人知道可以解决这个问题的东西吗?

当您想通过 Ajax 加载页面时,请使用$.mobile.changePage()

要移动到新域或加载没有 Ajax 的页面,请使用 window.location.href

$("#listitem").on("swiperight", function () {
  window.location.href = "http://www.google.com";
});
$("#listitem").on("swipeleft", function () {
  window.location.href = "http://www.yahoo.com";
});

演示

试试这个:

$(document).on("swipeleft","#listitem",function(){
  $.mobile.changePage("http://www.google.com");
});
$(document).on("swiperight","#listitem",function(){
  $.mobile.changePage("http://www.google.com");
});
相关文章:
  • 没有找到相关文章