jQuery移动动态页面不滚动

时间:2012-07-18 15:05:43

标签: jquery jquery-mobile scroll jquery-templates

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

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

2 个答案:

答案 0 :(得分:2)

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

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

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

答案 1 :(得分:0)

试试这个:

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

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