Implement the code for the music player (Html5+css3+jquery) _jquery

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.