Code for implementing the music player (html5 + css3 + jquery) and html5css3

Source: Internet
Author: User

Code for implementing the music player (html5 + css3 + jquery) and html5css3

Let's see how it works? The following small series will share with you some of my treasures. Lisa sang an episode at angel beats. This music player is implemented using html5, css, and jquery.

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 one above

Copy codeThe Code is as follows:
. 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.

Copy codeThe Code is as follows:
. 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

Copy codeThe Code is as follows:
$ ("Audio"). get (0). play ();
$ ("Audio"). get (0). pause ();

The above is all the content of this article. I hope you will like it.

Related Article

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.