HTML5 + CSS3 + jquery implements a simple music player, html5css3
... It's like a pancake... When others put their sisters, only the programmers who are forced to write code over there... My day!
Then today, I wrote a player in my early years... Does it look quite appealing! Lisa sang an episode at angel beats.
Finally, before explaining how to write this thing, I am a 24-year-old man from Shanghai. I am looking for a girlfriend and asked for a gentle personality... (Omitted 500 words)
<Div class = "Music"> <div class = "MusicPlaySound"> <div class =" MusicPlayBox ">
The html part is skipped .... It can basically be written...
.MusicPlayProcess.rotate{animation:rotate 30s infinite linear;}.MusicPlayProcess.pause{animation-play-state:paused;-webkit-animation-play-state:paused;}.MusicPicName.PicNameRotate{animation:rotate 4s infinite linear;}.MusicPicName.pause{animation-play-state:paused;-webkit-animation-play-state:paused;}@keyframes rotate{ from{ transform:rotate(0deg)} to{ transform:rotate(360deg)}}
Css is mainly interesting.
About a few css3 animations .... The above. MusicPlayProcess. rotate {animation: rotate 30 s infinite linear ;}
You can change this 30 s to the length of the song to a progress bar ~ HOHOHOHO)
Infinite unlimited playback, you know.
. MusicPicName. pause {animation-play-state: paused;-webkit-animation-play-state: paused ;}
Then pause the animation ,,,,
Compatibility is tough. Nothing else.
$(function(){ var play=1; $(".MusicPicButton").click(function(){ if(play==0){ $(this).attr("src","image/music/pause.png") $(".MusicPlayProcess").removeClass("pause") $(".MusicPicName").removeClass("pause") $("audio").get(0).play(); play=1; }else{ $(this).attr("src","image/music/play.png") $(".MusicPlayProcess").addClass("pause") $(".MusicPicName").addClass("pause") play=0; $("audio").get(0).pause(); } }) })
Here is the Jq Section
Play? OK Current Status 1 play 0 pause
$("audio").get(0).play();
$ ("Audio"). get (0). pause ();
Play... Pause...
Last demo
Http://xiaobai.52nhw.com/music.html
Then the point is, I am facing the loss of T_T, and beg for easy pitfalls. The target salary is over RMB. Three years of front-end development experience and two years of html5 mobile development experience, phonegap, and code preparation. Optimistic personality, willing to learn new things (let's watch which is fun, and now we are playing games !)