我的html页面包含几个jquery移动页面;
<div data-role="page" id="page1">
<div data-role="page" id="page2">
点击一个按钮,我想使用以下代码从第一页转到第二页。
$.mobile.changePage('#page2', {
transition: 'slideup'
}
);
但网站http://api.jquerymobile.com/jQuery.mobile.changePage/说;
注意:jQuery.mobile.changePage自jQuery Mobile 1.4.0起不推荐使用,将在1.5.0中删除。改为使用pagecontainer小部件的change()方法。
如何使用此功能在按钮点击时更改页面。
答案 0 :(得分:0)
如jquery 1.5 doc所述,您可以在click事件中使用此代码:
$( ":mobile-pagecontainer" ).pagecontainer( "change", "#page2");