久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      音樂播放器的制作實例(html5)


      相關(guān)技能

      • HTML5+CSS3(實現(xiàn)頁面布局和動態(tài)效果)

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

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

      • jQuery(快速編寫js腳本)

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

      實現(xiàn)的功能

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

      • 下一曲(切換下一首)

      • 隨機播放(當前歌曲播放完自動播放下一曲)

      • 單曲循環(huán)(點擊隨機播放圖標可切換成單曲循環(huán))

      • 音量調(diào)節(jié)(鼠標移入滑動設(shè)置音量大?。?/p>

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

      • 實時歌詞(點擊詞,切換歌詞界面,根據(jù)實時進度自動滾動歌詞)

      • 喜歡(點擊添加了一個active效果)

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

      audio 標簽使用

      • autoplay 自動播放

      • loop 循環(huán)播放

      • volume 音量設(shè)置

      • currentTime 當前播放位置

      • duration 音頻的長度

      • 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('')          }      });  }

      音樂進度條代碼

      _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 ? '^_^歌詞錯誤^_^' :  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);  }

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

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