久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      音樂(lè)播放器的制作實(shí)例(html5)


      相關(guān)技能

      • HTML5+CSS3(實(shí)現(xiàn)頁(yè)面布局和動(dòng)態(tài)效果)

      • Iconfont(使用矢量圖標(biāo)庫(kù)添加播放器相關(guān)圖標(biāo))

      • LESS (動(dòng)態(tài)CSS編寫)

      • jQuery(快速編寫js腳本)

      • gulp+webpack(自動(dòng)化構(gòu)建工具,實(shí)現(xiàn)LESS,CSS,JS等編譯和壓縮代碼)

      實(shí)現(xiàn)的功能

      • 播放暫停(點(diǎn)擊切換播放狀態(tài))

      • 下一曲(切換下一首)

      • 隨機(jī)播放(當(dāng)前歌曲播放完自動(dòng)播放下一曲)

      • 單曲循環(huán)(點(diǎn)擊隨機(jī)播放圖標(biāo)可切換成單曲循環(huán))

      • 音量調(diào)節(jié)(鼠標(biāo)移入滑動(dòng)設(shè)置音量大小)

      • 歌曲進(jìn)度條(可點(diǎn)擊切換進(jìn)度直接跳,也可以點(diǎn)擊小圓點(diǎn)拖拽切換進(jìn)度)

      • 實(shí)時(shí)歌詞(點(diǎn)擊詞,切換歌詞界面,根據(jù)實(shí)時(shí)進(jìn)度自動(dòng)滾動(dòng)歌詞)

      • 喜歡(點(diǎn)擊添加了一個(gè)active效果)

      • 分享(可以直接分享到新浪微博)

      audio 標(biāo)簽使用

      • autoplay 自動(dòng)播放

      • loop 循環(huán)播放

      • volume 音量設(shè)置

      • currentTime 當(dāng)前播放位置

      • duration 音頻的長(zhǎng)度

      • pause 暫停

      • play 播放

      • ended 返回音頻是否已結(jié)束

      播放和暫停代碼

      _Music.prototype.playMusic = function(){var _this = this;this.play.on('click', function(){if (_this.audio.paused) {              _this.audio.play();              $(this).html('');          } else {              _this.audio.pause();              $(this).html('')          }      });  }

      音樂(lè)進(jìn)度條代碼

      _Music.prototype.volumeDrag = function(){var _this = this;this.btn.on('mousedown', function(){          _this.clicking = true;          _this.audio.pause();      })this.btn.on('mouseup', function(){          _this.clicking = false;          _this.audio.play();      })this.progress.on('mousemove click', function(e){if(_this.clicking || e.type === 'click'){var len = $(this).width(),                  left = e.pageX - $(this).offset().left,                  volume = left / len;if(volume <= 1 || volume >= 0){                  _this.audio.currentTime =  volume * _this.audio.duration;                  _this.progressLine.css('width', volume *100 +'%');              }          }      });  }

      歌詞添加代碼

      _Music.prototype.readyLyric = function(lyric){this.lyricBox.empty();var lyricLength = 0;var html = '<div class="lyric-ani" data-height="20">';      lyric.forEach(function(element,index) {var ele = element[1] === undefined ? '^_^歌詞錯(cuò)誤^_^' :  element[1];          html += '<p class="lyric-line" data-id="'+index+'" data-time="' + element[0] + '"> ' +  ele + ' </p>';          lyricLength++;      });      html += '</div>';this.lyricBox.append(html);this.onTimeUpdate(lyricLength);  }

      代碼還有很多就不一一添加了,覺(jué)得還行的話可以點(diǎn)下喜歡(也可以在我的GitHub給個(gè)Star),你的喜歡和Star是我繼續(xù)創(chuàng)作的動(dòng)力,非常感謝?。?!源碼加群

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)