jquery mobile方法使用

来源:互联网 发布:网络诈骗如何处理 编辑:程序博客网 时间:2024/04/30 19:15

1、翻屏

jquery mobile支持方法--

自动触发:

$(window).bind('orientationchange',function(e){

console.log(e.orientation);     //输出portrait或者landscape

//翻屏执行代码,如改变CSS样式

});

手动触发:

$('button').click(function(){

$(window).trigger('orientationchange');

})

原始方法--

window.addEventListener("orientationchange",orientationChange,true);

function orientationChange(e){

alert(window.orientation);   //输出-90 || 0 || 90 || 180

}

2、显示&隐藏

$('div#main').live('pageshow',function(e,ui){

console.log(ui.prePage.selector);        //获得页面id

})

$('div#main').live('pagehide',function(e,ui){

console.log(ui.nextPage.selector)

})


原创粉丝点击