1. 程式人生 > 其它 >JQ實現音樂外掛並自動播放

JQ實現音樂外掛並自動播放

這裡分享我最近寫出來的一個小東西,基於jq的音樂播放器,可以巢狀到網站

效果截圖:

具體首頁程式碼如下:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1" />
	<title></title>
	<link rel="stylesheet" href="css/player.css">
</head>
<body>
<div id="QPlayer">
<div id="pContent">
	<div id="player">
		<span class="cover"></span>
		<div class="ctrl">
			<div class="musicTag marquee">
				<strong>Title</strong>
				 <span> - </span>
				<span class="artist">Artist</span>
			</div>
			<div class="progress">
				<div class="timer left">0:00</div>
				<div class="contr">
					<div class="rewind icon"></div>
					<div class="playback icon" id="play-btn"></div>
					<div class="fastforward icon"></div>
				</div>
				<div class="right">
					<div class="liebiao icon"></div>
				</div>
			</div>
		</div>
	</div>
	<div class="ssBtn">
	        <div class="adf"></div>
    </div>
</div>
<ol id="playlist"></ol>
</div>

<script src="js/jquery.min.js"></script>
<script src="js/jquery.marquee.min.js"></script>

<script>
	var	playlist = [
		{title:"永珍霜天",artist:"三無MarBlue",mp3:"music/永珍霜天.mp3",cover:"music/永珍霜天.png",}
	];
    var isRotate = true;
    var autoplay = true;
</script>
<script src="js/player.js"></script>
<script>
	function bgChange(){
		var lis= $('.lib');
		for(var i=0; i<lis.length; i+=2)
		lis[i].style.background = 'rgba(246, 246, 246, 0.5)';
	}
	window.onload = bgChange;
	setTimeout(()=>{
		$("#play-btn").click()
	},2000)
	setTimeout(()=>{
		$("#play-btn").click()
	},4000)

</script>

</body>
</html>

整體下載:點選下載

下載後本地開啟即可

如果對您有所幫助,歡迎您點個關注,我會定時更新技術文件,大家一起討論學習,一起進步。