Mobie 有用的几个css js代码

1. 防止页面缩放

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>

 

2.隐藏地址栏

// When ready...
window.addEventListener("load",function() {
    // Set a timeout...
    setTimeout(function(){
        // Hide the address bar!
        window.scrollTo(0, 1);
    }, 0);
});

 

3.检测方向变化

// Listen for orientation changes

window.addEventListener("orientationchange", function() {

    // Announce the new orientation number

    console.log(window.orientation);

    // 0 means portrait, 90 means landscape rotated to the left, -90 means landscape rotated to the right

}, false);
 
 
4.照片选择器
 
  <input type="file" name="image" accept="image/*" capture>


原文:http://abujj.me/archives/484

你可能感兴趣的:(css)