Look at the following effect picture is very good, how to achieve it? The following small series to share my treasures, Lisa sang in the Angel Beats episode. Use HTML5, CSS, jquery to implement this music player.
A treasure that Lisa sang in the Angel Beats episode
Finally in a brief description of how this thing to write before, I am male, 24 years old, hometown of Shanghai, recruitment girlfriend One, request: Character docile ... (omitted 500 words)
<div class= "Music" >
<div class= "Musicplaysound" >
<div class=
" Musicplaybox ">
The HTML part just skips over .... Basic will write ...
. 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 part of the main pick some interesting
What about a few css3 animations .... The one above.
Copy Code code as follows:
. Musicplayprocess.rotate
{animation:rotate 30s infinite linear;}
You can change this 30s to a song. The length of time becomes the progress bar O~hohohoho (lazy people always have lazy way)
Infinite, do you know how to play infinity?
Copy Code code as follows:
. musicpicname.pause{animation-play-state:paused;
-webkit-animation-play-state:paused;}
And then pause the animation 、、、、
Compatibility is a mishap, 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 ();}})
This is the JQ part.
Play? Determine the current status 1 playback 0 pause
Copy Code code as follows:
$ ("audio"). Get (0). Play ();
$ ("audio"). Get (0). Pause ();
The above is the entire content of this article, I hope you like.