久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      html5 音頻播放圖文實例

      根據(jù)html5實現(xiàn)的簡單的音頻播放,還是挺好的,可以借鑒,下面上代碼了

      <!doctype html>  <html lang="en">  <head>  	<meta charset="UTF-8">  	<meta name="viewport" content="width=device-width,initial-scale=1 user-scalable=0"/>  	<link rel="shortcut icon" href="img/logo.png">  	<title>html5 audio音頻播放</title>  	<style>  		*{ margin: 0; padding:0;}  		body{-webkit-tap-highlight-color: rgba(0,0,0,0); font-family: "微軟雅黑"}  		h1{ width: 100%; font-size: 1.5em; text-align: center; line-height: 3em; color:#47c9af; }  		#audio{ width: 100%;}  		#control{ width: 150px; height: 150px; line-height: 150px; text-align: center; border-radius: 200px; border:none; color:#fff; margin-top: -75px; margin-left:-75px; left:50%; top:50%; position: absolute; box-shadow: #888 0 0 8px;}  		.color_gray{ background: #e4e4e4}  		.hide{ display: none;}  		.show{ display: block;}  		.play{ background:  #f06060;}  		.pause{ background:skyblue}  		/*進(jìn)度條樣式*/  		.progressBar{ width: 100%; height: 10px;margin: 30px auto 30px auto; position:absolute; left: 0; bottom: 35px;}  		.progressBar p{ position: absolute;}  		.progressBar .progressBac{ width: 100%; height: 10px;  left: 0; top:0; background: #e4e4e4;}  		.progressBar .speed{width: 100%; height: 10px; left: -100%; background: #f06060; }  		.progressBar .drag{ width: 30px; height: 30px; left: 0; top:-10px;  background: skyblue; opacity: 0.8; border-radius: 50px; box-shadow: #fff 0 0 5px;}  		/*時間樣式*/  		#time{ width: 100%; height: 20px;position: absolute; left: 0; bottom:30px; color:#888;}  		.tiemDetail{ position: absolute; right:10px; top:0;}  		#songInfo{overflow: hidden; width: 200px; height:50px; line-height: 50px; text-align: center; color:#34495e;   margin-top: -25px; margin-left:-100px; left:50%; top:70%; position: absolute;}  		.shareImg{ position: absolute; left: 100000px;}  	</style>  </head>  	  <body>  	<script>  $(function() {  	getSong();  })    //獲取歌曲鏈接并插入dom中  function getSong() {   	var audio = document.getElementById("audio");  	audio.src = "http://frontman.qiniudn.com/songnotime.mp3";  	audio.loop = true; //歌曲循環(huán)  	playCotrol(); //播放控制函數(shù)    }    //點擊播放/暫停  function clicks() {  	var audio = document.getElementById("audio");  	$("#control").click(function() {  		if ($("#control").hasClass("play")) {  			$("#control").addClass("pause").removeClass("play");  			audio.play();//開始播放  			dragMove();//并且滾動條開始滑動  			$("#control").html("暫停播放");  		} else {  			$("#control").addClass("play").removeClass("pause");  			$("#control").html("點擊播放");  			audio.pause();  		}  	})  }    //播放時間  function timeChange(time, timePlace) {//默認(rèn)獲取的時間是時間戳改成我們常見的時間格式  	var timePlace = document.getElementById(timePlace);  	//分鐘  	var minute = time / 60;  	var minutes = parseInt(minute);  	if (minutes < 10) {  		minutes = "0" + minutes;  	}  	//秒  	var second = time % 60;  	seconds = parseInt(second);  	if (seconds < 10) {  		seconds = "0" + seconds;  	}  	var allTime = "" + minutes + "" + ":" + "" + seconds + ""  	timePlace.innerHTML = allTime;  }    //播放事件監(jiān)聽  function playCotrol() {  	audio.addEventListener("loadeddata", //歌曲一經(jīng)完整的加載完畢( 也可以寫成上面提到的那些事件類型)  		function() {  			$("#control").addClass("play").removeClass("color_gray");  			$("#control").html("點擊播放");  			addListenTouch(); //歌曲加載之后才可以拖動進(jìn)度條  			var allTime = audio.duration;  			timeChange(allTime, "allTime");  			setInterval(function() {  				var currentTime = audio.currentTime;  				$("#time .currentTime").html(timeChange(currentTime, "currentTime"));  			}, 1000);  			clicks();  		}, false);    	audio.addEventListener("pause",  		function() { //監(jiān)聽暫停  			$("#control").addClass("play").removeClass("pause");  			$("#control").html("點擊播放");  			if (audio.currentTime == audio.duration) {  				audio.stop();  				audio.currentTime = 0;  			}  		}, false);  	audio.addEventListener("play",  		function() { //監(jiān)聽暫停  			$("#control").addClass("pause").removeClass("play");  			$("#control").html("暫停播放");  			dragMove();  		}, false);  	audio.addEventListener("ended", function() {  		alert(0)  	}, false)  }  	  //進(jìn)度條  這里我用的是事件實現(xiàn)進(jìn)度拖動 如果不太熟悉touch的可以看下我之前寫的一個小demo http://www.cnblogs.com/leinov/p/3701951.html   var startX, x, aboveX = 0; //觸摸時的坐標(biāo) //滑動的距離  //設(shè)一個全局變量記錄上一次內(nèi)部塊滑動的位置     //1拖動監(jiān)聽touch事件  function addListenTouch() {  	document.getElementById("drag").addEventListener("touchstart", touchStart, false);  	document.getElementById("drag").addEventListener("touchmove", touchMove, false);  	document.getElementById("drag").addEventListener("touchend", touchEnd, false);  	var drag = document.getElementById("drag");  	var speed = document.getElementById("speed");  }    //touchstart,touchmove,touchend事件函數(shù)   function touchStart(e) {     	e.preventDefault();   	var touch = e.touches[0];   	startX = touch.pageX;    }   function touchMove(e) { //滑動             	e.preventDefault();   	var touch = e.touches[0];   	x = touch.pageX - startX; //滑動的距離   	//drag.style.webkitTransform = 'translate(' + 0+ 'px, ' + y + 'px)';  //也可以用css3的方式        	drag.style.left = aboveX + x + "px"; //     	speed.style.left = -((window.innerWidth) - (aboveX + x)) + "px";   }   function touchEnd(e) { //手指離開屏幕   	e.preventDefault();   	aboveX = parseInt(drag.style.left);   	var touch = e.touches[0];   	var dragPaddingLeft = drag.style.left;   	var change = dragPaddingLeft.replace("px", "");   	numDragpaddingLeft = parseInt(change);   	var currentTime = (numDragpaddingLeft / (window.innerWidth - 30)) * audio.duration;//30是拖動圓圈的長度,減掉是為了讓歌曲結(jié)束的時候不會跑到window以外   	audio.currentTime = currentTime;   }  //3拖動的滑動條前進(jìn)  function dragMove() {  	setInterval(function() {  		drag.style.left = (audio.currentTime / audio.duration) * (window.innerWidth - 30) + "px";  		speed.style.left = -((window.innerWidth) - (audio.currentTime / audio.duration) * (window.innerWidth - 30)) + "px";  	}, 500);  }  </script>    <h1>html5 audio 音頻播放demo</h1>    <!--audiostart-->  <audio id="audio" src=""  loop="loop" autoplay="autoplay" ></audio>  <!--audio End-->        <!--播放控制按鈕start-->  <button id="control" class="">loading</button>  <!--播放控制按鈕end-->    <!--時間進(jìn)度條塊兒start-->  <section class="progressBar">  	<p class="progressBac"></p>  	<p class="speed" id="speed"></p>  	<p class="drag" id="drag"></p>  </section>  <!--時間進(jìn)度條塊兒end-->    <!--播放時間start-->  <p id="time"><p class="tiemDetail"><span class="currentTime" id="currentTime">00:00</span>/<span class="allTime" id="allTime">00:00</span></p></p>  <!--播放時間end-->  <!--歌曲信息start-->  <p id="songInfo">沒時間-Leinov<p class="shareImg"><img src="img/html5audio.jpg" alt=""></p></p>  <!--歌曲信息end-->  <script src="js/zepto.js"></script>  </body>  </html>

      2. [圖片] audioplay.png

      html5 音頻播放圖文實例

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號