微信小程序?qū)崿F(xiàn)音樂(lè)播放頁(yè)面布局
本文實(shí)例為大家分享了微信小程序?qū)崿F(xiàn)音樂(lè)播放頁(yè)面的布局,供大家參考,具體內(nèi)容如下
1.效果圖如下,點(diǎn)擊播放按鈕后,光碟轉(zhuǎn)動(dòng),播放按鈕變?yōu)闀和0粹o;播放中點(diǎn)擊暫停,光碟復(fù)位,暫停按鈕恢復(fù)為播放按鈕。
本文僅提供樣式布局,其他具體響應(yīng)不作介紹
2.樣式布局代碼
wxml:
<view class="page_music"> <view class='icon {{isPlay?"rotateAu":""}}' mode="widthFix"> </view> <view class="tools"> <view class="last" bindtap="last"> </view> <view class='{{isPlay?"pause":"play"}}' bindtap="play"> </view> <view class="next" bindtap="next"> </view> </view> <view class="volume"> <view class="volumeIcon"> </view> <view class="sl"> <slider min='0' max='10' step="1" value="0" bindchange="slide"/> </view> </view> </view>
wxss:
.page_music{ position: absolute; width: 100%; height: 80%; } .icon{ position: relative; width: 500rpx; height: 500rpx; top:5%; left: 125rpx; background-image: url(""); /*放入光碟圖片*/ background-size: 100% 100%; background-repeat:no-repeat; background-position: center; } .tools{ position: relative; width: 80%; height: 10%; top: 10%; left: 10%; } .last{ width: 100rpx; height: 100rpx; position: absolute; left: 0; top:0; background-image: url(""); /*放入上一首圖標(biāo)*/ background-size: 100% 100%; background-repeat:no-repeat; background-position: center; } .play{ width: 100rpx; height: 100rpx; position: absolute; left: 42%; top:0; background-image: url(""); /*放入播放圖標(biāo)*/ background-size: 100% 100%; background-repeat:no-repeat; background-position: center; } .pause{ width: 100rpx; height: 100rpx; position: absolute; left: 42%; top:0; background-image: url(""); /*放入暫停圖標(biāo)*/ background-size: 100% 100%; background-repeat:no-repeat; background-position: center; } .next{ width: 100rpx; height: 100rpx; position: absolute; right: 0; top:0; background-image: url(""); /*放入下一首圖標(biāo)*/ background-size: 100% 100%; background-repeat:no-repeat; background-position: center; } .volume{ position: relative; width: 80%; height: 10%; top: 20%; left: 10%; } .volumeIcon{ position: absolute; left: 0; width: 80rpx; height: 80rpx; top:0; background-image: url(""); /*放入音量圖標(biāo)*/ background-size: 100% 100%; background-repeat:no-repeat; background-position: center; } .sl{ position: absolute; right: 0; width: 80%; height: 100%; top: 0; background-image: url(""); /*放入滑動(dòng)條背景圖片*/ background-size: 100% 100%; background-repeat:no-repeat; background-position: center; } .rotateAu{ animation: rotate 3s linear infinite; } @keyframes rotate{ from{transform: rotate(0deg)} to{transform: rotate(360deg)} }
js:
Page({ data:{ isPlay:false, }, play:function(e){ if(this.data.isPlay==true) { this.setData({ isPlay:false }) } else { this.setData({ isPlay:true }) } } })
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
javascript巧用eval函數(shù)組裝表單輸入項(xiàng)為json對(duì)象的方法
這篇文章主要介紹了javascript巧用eval函數(shù)組裝表單輸入項(xiàng)為json對(duì)象的方法,實(shí)例分析了JavaScript使用eval函數(shù)動(dòng)態(tài)構(gòu)造json對(duì)象的相關(guān)技巧,需要的朋友可以參考下2015-11-11javascript對(duì)象的property和prototype是這樣一種關(guān)系
javascript對(duì)象的property和prototype是這樣一種關(guān)系...2007-03-03javascript實(shí)現(xiàn)無(wú)法關(guān)閉的彈框
本文分享了javascript實(shí)現(xiàn)無(wú)法關(guān)閉的彈框的實(shí)例代碼,感興趣的朋友可以看下2016-11-11微信小程序?qū)崿F(xiàn)打開(kāi)并下載服務(wù)器上面的pdf文件到手機(jī)
這篇文章主要介紹了微信小程序?qū)崿F(xiàn)打開(kāi)并下載服務(wù)器上面的pdf文件到手機(jī),本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-09-09JS實(shí)現(xiàn)網(wǎng)頁(yè)背景顏色與select框中顏色同時(shí)變化的方法
這篇文章主要介紹了JS實(shí)現(xiàn)網(wǎng)頁(yè)背景顏色與select框中顏色同時(shí)變化的方法,實(shí)例分析了javascript操作select及css樣式的技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-02-02js實(shí)現(xiàn)按鈕控制帶有停頓效果的圖片滾動(dòng)
這篇文章主要介紹了js實(shí)現(xiàn)按鈕控制帶有停頓效果的圖片滾動(dòng),,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-08-08基于js實(shí)現(xiàn)checkbox批量選中操作
這篇文章主要為大家詳細(xì)介紹了基于js實(shí)現(xiàn)checkbox批量選中操作,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-11-11