0

我有一个页面,允许用户使用滑动手势来导航页面。我能够让这个工作,但我不能使用本机 jQM 方法 changePage。我不能使用changePage,因为我们为下一页动态生成URL。这是工作脚本:

$(function(){
  $('#page_div').live('swiperight', function(event){
location.href='/<?= $this->nextSlideLink ?>';
});
  $('#page_div').live('swipeleft', function(event){
location.href='/<?= $this->prevSlideLink ?>';
  });
});

现在,问题是我无法让 jQM 转换正常工作,因为我没有使用 changePage。

通常你会做这样的事情,但不是在这种情况下:

$('#page_div').live('swiperight', function(event){
$mobile.changePage('<?= $this->prevSlideLink ?>' {transition:'slide'});
 });

有谁知道我怎样才能让过渡工作?

4

1 回答 1

0

你为什么不使用 changePage ?

如果你真的需要避免 changePage,你可以尝试模拟点击:

jQuery('<a href="<?= $this->prevSlideLink ?>"/>')
    .appendTo(jQuery.mobile.activePage)
    .trigger('click')
    .remove();
于 2012-05-15T21:58:16.557 回答