Carrie_IT
2016-03-28 11:07
window.onload = function(){ var music = document.getElementById('music'); var audio = document.getElementsByTagName('audio')[0]; //当音乐播放完停止的时候,自动停止光盘旋转效果 audio.addEventListener("ended",function(event){ music.setAttribute("class",""); },false); //点击音乐图标,控制音乐播放效果 //music.onclick = function(){ // if(audio.paused){ // audio.play(); // //this.setAttribute("class","paly"); // this.style.animationPlayState = "running"; // this.style.webkitAnimationPlayState = "running"; // }else{ // audio.pause(); // //this.setAttribute("class",""); // this.style.animationPlayState = "paused"; // this.style.webkitAnimationPlayState = "paused"; // }; // }; music.addEventListener("touchstart",function(event){ if(audio.paused){ audio.play(); this.setAttribute("class","paly"); }else{ audio.pause(); this.setAttribute("class",""); }; },false) };
他这真是粗心大意啊
this.setAttribute("class","paly");
play写错了……
HTML5+CSS3实现春节贺卡
110057 学习 · 450 问题
相似问题