HTML5和css3的總結四

來源:互聯網
上載者:User

標籤:

HTML5的新東西總結四:

1》video和audio
聲明方法(可以製作背景音樂)
var oV/oA=new Video()/Audio();
oV/oA.src=‘‘;
oV/oA.play();

雙標籤聲明:
<video src=""></video>
<audio src=""></audio>

屬性:
a、src和poster poster:指定一張圖片,當視頻資料無效時顯示(載入、地址錯誤等);
b、preload是否預先載入,預設為auto,還有none和metadata
c、loop是否自動迴圈,布爾值屬性
d、controls顯示播放控制項
e、width和height
f、source標籤包含type(媒體類型的src) 預設為all

功能:
a、暫停 pause 播放 play
b、音量控制 volume+=0.1volume-=0.1(預設的值是0-1)
c、靜音muted 返回布爾值,true表示靜音 false表示不靜音
d、快進和快退currentTime++快進 currentTime-- 快退
e、全屏Video.webkitRequestFullscreen();
f、捲軸事件Video.ontimeupdate 事件對象中含有 Video.currentTime 已經播放的時間 Video.duration 總時間
g、播放完畢 事件onended
h、當雙擊的時候(事件)ondblclick

2》動畫
transition過渡 用於簡單的過渡動畫
animation
定義:@keyframes name{
from/0%{ }
to/100%{ }
}
調用:animation:1s name linear/ease infinite forwards;

分寫:
animation-name:name;名稱
animation-duration:4s;時間
animation-timing-function:linear; 運動狀態
animation-fill-mode:forwards; 最後狀態
animation-iteration-count:infinite; 動畫次數

分享一個css3動畫特效庫 animation.css 網址: https://daneden.github.io/animate.css/

3》地理位置
對象:navigator-geolocation

navigator-geolocation.getCurrentPosition(function(ev){alert(‘成功時包含ev事件對象,可以列印出來‘);ev.coords},function(ev){ev.code})

ev.coords:座標
latitude——緯度
longitude——經度
accuracy——精確度,單位米
altitude——高度,單位米 海拔
altitudeAccuracy——高度的精確地,單位米
heading—運動的方向,相對於正北方向的角度 朝向
speed——運動的速度(假設你在地平線上運動),單位米/秒
accuracy >70 可用 精確度

ev.code的傳回值:
1 使用者拒絕
2 擷取逾時 網路問題
3 擷取失敗

即時擷取地理位置:navigator.geolocation.watchPosition();
和定時器相同可以清除;
清除方法:navigator.geolocation.clearWatch();

 



HTML5和css3的總結四

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.