欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery Mobile 方向事件

jQuery Mobile orientationchange 事件

orientationchange 事件在用戶垂直或水平旋轉(zhuǎn)移動(dòng)設(shè)備時(shí)被觸發(fā)。

Mobile

Mobile

如需使用 orientationchange 事件,請(qǐng)把它添加到 window 對(duì)象:

$(window).on("orientationchange",function(){
  alert("方向已改變!");
});

callback 函數(shù)可以設(shè)置一個(gè)參數(shù),即 event 對(duì)象,它會(huì)返回移動(dòng)設(shè)備的方向:"portrait" (設(shè)備被握持的方向是垂直的)或 "landscape" (設(shè)備被握持的方向是水平的):

實(shí)例

$(window).on("orientationchange",function(event){
  alert("方向是:" + event.orientation);
});

親自試一試

由于 orientationchange 事件與 window 對(duì)象綁定,我們能夠使用 window.orientation 屬性來,例如,設(shè)置不同樣式以區(qū)分 portrait 和 landscape 視圖:

實(shí)例

$(window).on("orientationchange",function(){
  if(window.orientation == 0) // Portrait
  {
    $("p").css({"background-color":"yellow","font-size":"300%"});
  }
  else // Landscape
  {
    $("p").css({"background-color":"pink","font-size":"200%"});
  }
});

親自試一試

提示:window.orientation 屬性對(duì) portrait 視圖返回 0,對(duì) landscape 視圖返回 90 或 -90。