【发布时间】:2013-02-19 21:03:44
【问题描述】:
我很难过,我有一个使用 mootools 的翻转时钟,然后是一个使用 Yahoo API 的天气小部件,现在我不知道是什么原因造成的
"无法在初始化之前调用面板上的方法;试图 调用方法'open'"
所以我关注了这个演示,http://view.jquerymobile.com/master/docs/examples/panels/panel-swipe-open.php#demo-page,现在我得到了错误。
$( document ).on( "pageinit", "#demo-page", function() {
$( document ).on( "swipeleft swiperight", "#demo-page", function( e ) {
// We check if there is no open panel on the page because otherwise
// a swipe to close the left panel would also open the right panel (and v.v.).
// We do this by checking the data that the framework stores on the page element (panel: open).
if ( $.mobile.activePage.jqmData( "panel" ) !== "open" ) {
if ( e.type === "swipeleft" ) {
$( "#right-panel" ).panel( "open" );
} else if ( e.type === "swiperight" ) {
$( "#left-panel" ).panel( "open" );
}
}
});
});
我有点走投无路,因为我已经成功了,请随意查看我的代码,http://yaasko.com/gra423/project-4.3/ 如果您尝试向左或向右滑动,控制台将输出错误。
如果你能帮助我,请告诉我,第一次使用 jquery 移动用户!
【问题讨论】:
标签: jquery jquery-mobile initialization panel swipe