旋转或更改方向时下拉未对齐(iPad)

时间:2015-10-01 10:12:38

标签: javascript html ios css

旋转设备时,

下拉列表未对齐。我希望下拉列表在select标签上对齐。旋转时我使用javascript关闭或模糊下拉列表但浏览器崩溃了。有没有解决这个问题?以下是我用于方向检测的代码。

enter image description here

$(document).ready(function(){

var winWidth = $(window).width();

if(winWidth <= 768) {
   detectOrientation();
   window.onorientationchange = detectOrientation;
   function detectOrientation(){

      if (typeof window.onorientationchange != 'undefined'){
        if ( orientation == 0 ) {
            //Do Something In Portrait Mode

        }
        else if ( orientation == 90 ) {
            //Do Something In Landscape Mode

        }
        else if ( orientation == -90 ) {
            //Do Something In Landscape Mode

        }
        else if ( orientation == 180 ) {
            //Do Something In Portrait Mode

        }
    }
  }
} 

else {
  alert("not passed");
}
});

0 个答案:

没有答案