【问题标题】:jQuery mobile dynamique page doesn't scrolljQuery 移动动态页面不滚动
【发布时间】:2012-07-18 15:05:42
【问题描述】:

我使用 jQuery mobile 框架和 jQuery Tmpl 来创建一个仅适用于 iPhone 的网络应用程序。

每个静态页面都可以正常工作
动态页面(用 Json 和 Tmpl 构建)不会滚动。

【问题讨论】:

  • 我只保留了jqm CSS,但问题仍然存在。
  • 我试过 .trigger( 'updatelayout' );但仍然无法正常工作。
  • 我试过 .listview('refresh') 也没有用
  • .scrollview() 和 .trigger('create') 都没有
  • stackoverflow.com/questions/8356324/… 同样的问题,也没有真正的答案

标签: jquery jquery-mobile scroll jquery-templates


【解决方案1】:

在我们使用的 jQuerymobile 模板中,是这样的:

$(document).on('touchmove', function(e){
    e.preventDefault();
});

阻止我们的页面滚动。
很明显:S

【讨论】:

    【解决方案2】:

    试试这个:

    $( '#foo' ).trigger( 'updatelayout' );
    

    updatelayout 事件通知其他组件他们可能需要调整其布局以响应其内容更改。开发人员正在构建动态应用程序,从页面中注入、隐藏或删除内容,或以任何影响页面尺寸的方式对其进行操作,也可以手动触发此 updatelayout 事件,以确保页面上的组件响应更新变化。见http://jquerymobile.com/demos/1.1.1/docs/api/events.html

    【讨论】:

      猜你喜欢
      • 2013-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多