1. 程式人生 > >博客美化:為你的博客添加音樂插件

博客美化:為你的博客添加音樂插件

play pen ont 播放器 iam layer iframe 效果 idg

無意中發現,心血來潮就試著放到博客裏。以網易雲音樂為例,其他播放器插件大同小異。

1. 效果

技術分享

2. 添加到博客

2.1 播放器插件

  主流的都可以,官方都提供外鏈:網易雲、蝦米

  拿網易雲來說:

<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=450 src="//music.163.com/outchain/player?type=1&id=1678955&auto=1&height=430"></iframe>

  網易雲提供的是iframe標簽,而博客園不能添加iframe,所以把此標簽替換成embed就可以了

<embed frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=450 src="//music.163.com/outchain/player?type=1&id=1678955&auto=1&height=430"></embed>

  參數中:id可以換成自己喜歡的歌單id,auto代表是否自動播放

網易雲的插件感覺好久沒更新了:
   1. 無論放什麽歌,專輯封面永遠是第一首的
   2. 歌名位置顯示的為什麽不是當前播放的歌名啊餵~
   3. 如果有一首歌涉及版權,播放到這首歌就會停止,而且也不能選擇播放這首歌
ヽ(`⌒´)?┻━┻︵ ┻━┻  

2.2 Code

  將下面代碼復制到頁腳Html代碼中,大家可以引用我的樣式文件,有需要的可以下載自己修改

<link rel="stylesheet" type="text/css" href="https://files.cnblogs.com/files/bndong/menu_cornermorph.css" />

<div class="menu-wrap">
    <embed frameborder="no" border="0" marginwidth="0" marginheight="0" width=280 height=355 
src="//music.163.com/outchain/player?type=0&id=316722029&auto=0&height=430"></embed> </div> <button class="menu-button" id="open-button"><img class="menu-rotation" src="https://files.cnblogs.com/files/bndong/music.gif"><span>Open Menu</span></button> <div class="content-wrap"></div> <script src="https://files.cnblogs.com/files/bndong/classie.js"></script> <script src="https://files.cnblogs.com/files/bndong/main.js"></script>

博客美化:為你的博客添加音樂插件