婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > HTML5 device access 設備訪問詳解

HTML5 device access 設備訪問詳解

熱門標簽:威海營銷外呼系統招商 漳州人工外呼系統排名 跟電銷機器人做同事 農村住宅地圖標注 濟南辦理400電話 ai電銷機器人連接網關 鶴壁手機自動外呼系統怎么安裝 鄭州電銷外呼系統違法嗎 中紳電銷智能機器人

camera api (含圖片預覽)

參考地址

主要為利用input type=file, accept="image/*" 進行處理

圖片預覽方式(兩種)

const file = e.target.files[0]
// 方式1 
const url1 = window.URL.createObjectURL(file);
let url2

// 方式2
const reader = new FileReader();
reader.onload = (e) => {
    url2 = e.target.result;
};
reader.readAsDataURL(file);

touch events (觸屏事件)

參考地址

  1. touchstart
  2. touchen
  3. touchcancel 電話的接入或者彈出信息等比較高級的事件觸發,一般做保存操作
  4. touchmove
  5. geolocation

參考地址

注意谷歌瀏覽器要https才能提供定位服務

    if (navigator.geolocation){
        navigator.geolocation.getCurrentPosition((position) => {
            this.geolocation = `latitude:${position.coords.latitude},longitude:${position.coords.longitude}`
        }, (err) => {
            console.log(err);
        }, {
                enableHighAccuracy: true, 
                maximumAge        : 30000,  // buffer memory timre
                timeout           : 27000   // waiting time 
        })
    } else {
        alert('geolocation not supported!')
    }

device orientation and motion

參考地址 

    window.addEventListener('deviceorientation',(doe) => {
        this.absolute = doe.absolute //false 表示方向數據由設備本身坐標系提供
        this.alpha = doe.alpha // 繞Z軸0-360 進入時手機水平正對的方向為0或360
        this.beta = doe.beta // 繞X軸-180~180 描述由前向后旋轉
        this.gamma = doe.gamma // 繞Y軸-90~90 描述由左向右旋轉
    }, true)

    // chrome v65 只支持accelerationIncludingGravity和interval(應該因為一些限制沒有找到),其它瀏覽器最新版基本都支持
    window.addEventListener('devicemotion', (dme) => {
        this.acceleration = dme.acceleration
        this.accelerationIncludingGravity = dme.accelerationIncludingGravity
        this.rotationRate = dme.rotationRate
        this.interval  = dme.interval 
    }, false)

Pointer Lock(鼠標鎖定)

參考地址 

    <button onclick="lockPointer();">鎖住它!</button>
    <div id="pointer-lock-element" style="width:500px;height:500px;background-color: red"></div>
    // 簡單示例,將鼠標鎖定在 pointer-lock-element 元素內
    let = document.getElementById("pointer-lock-element");
    
    document.addEventListener("mousemove", function(e) {
        var movementX = e.movementX 
            movementY = e.movementY

        // 打印鼠標移動的增量值。
        console.log("X=" + movementX, "Y=" + movementY);
    }, false);

    function lockPointer() {
        elem = document.getElementById("pointer-lock-element");
        elem.requestPointerLock = elem.requestPointerLock    ||
                            elem.mozRequestPointerLock ||
                            elem.webkitRequestPointerLock;
        elem.requestPointerLock();
    }

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

標簽:惠州 甘南 萍鄉 蘇州 咸陽 營口 紅河 文山

巨人網絡通訊聲明:本文標題《HTML5 device access 設備訪問詳解》,本文關鍵詞  HTML5,device,access,設備,訪問,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《HTML5 device access 設備訪問詳解》相關的同類信息!
  • 本頁收集關于HTML5 device access 設備訪問詳解的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 开化县| 南皮县| 繁昌县| 旅游| 图木舒克市| 忻城县| 隆德县| 永城市| 苗栗市| 古交市| 广丰县| 贡觉县| 油尖旺区| 朝阳区| 仙桃市| 达日县| 清原| 西昌市| 定安县| 古交市| 金乡县| 鹤壁市| 铜川市| 武平县| 海阳市| 洛隆县| 新河县| 中西区| 吉安县| 离岛区| 平塘县| 右玉县| 项城市| 博野县| 嵊州市| 镇赉县| 房产| 涟源市| 渭南市| 固始县| 西充县|