Orientation change event implementation by jquery mobile in phone gap

后端 未结 4 1043
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-31 18:52

Could someone please let me know the right code for orientation change event by jquery mobile in phone gap? Where and how do I implement this orientationChange function?

4条回答
  •  醉话见心
    2021-01-31 19:26

    $(window).bind('orientationchange', _orientationHandler);
    

    then in the _orientationHandler function, have something like:

    if(event.orientation){
          if(event.orientation == 'portrait'){
                      //do something
          }
          else if(event.orientation == 'landscape') {
                        //do something
          }
    }
    

提交回复
热议问题