Skip to Content
MOBILE HTML5學習手冊
book

MOBILE HTML5學習手冊

by Estelle Weyl
June 2014
Intermediate to advanced
488 pages
9h 56m
Chinese
GoTop Information, Inc.
Content preview from MOBILE HTML5學習手冊
以行動與觸控設備為目標
|
395
每當使用者移動設備時,就會發生
deviceorientation
事件,包括特性:alpha0-
360)、 beta-90-90)與 gamma-180-180),分別為設備繞著它的 zx y 軸旋轉的
數值。這些測量值通常與第一次定位的方向有關,因此
deviceorientation
適合測量相對
原始位置的移動方向。
設備狀態
設備在線上嗎?如果是,它使用哪一種網站連結類型?設備還有多少電力?我們不但可
以知道使用者怎樣拿設備,也可以判斷設備的狀態。
網路連結
Network API
http://www.w3.org/TR/netinfo-api/
)公開了
navigator.connection.type
特性
與字串值
unknown
ethernet
wifi
2g
3g
4g
none
。有一些瀏覽器會回傳它們的整
數或常數值:
WIFI
CELL
CELL_3G
CELL_2G
CELL_4G
UNKNOWN
。這個 API 在第一次連
結時會回傳連結類型。但是設備並非永遠連到網路,連結類型也有可能改變。
較新的 API 會判斷連結的品質,而不是連結類型。因為所有電話公司都會吹噓他們的
連線,所以這種方式比邏輯性的歸納有意義多了。這個版本還沒有受到良好的支援,
但已經有一些瀏覽器支援它了。在較新的規格中,
navigator.connection
物件會公開
bandwidth
metered
屬性,與一個
change
事件。
如果是手機離線或未知,
navigator.connection.bandwidth ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

JAVASCRIPT網頁應用程式設計

JAVASCRIPT網頁應用程式設計

Alex MacCaw

Publisher Resources

ISBN: 9789863471240