微信小程序?qū)崿F(xiàn)點(diǎn)擊圖片旋轉(zhuǎn)180度并且彈出下拉列表
本文為大家分享了微信小程序?qū)崿F(xiàn)圖片旋轉(zhuǎn)、下拉列表的具體代碼,供大家參考,具體內(nèi)容如下
正文:
先上效果圖:
index.wxml
<view class="phone_one" bindtap="clickPerson"> <view class="phone_personal">{{firstPerson}}</view> <image src="../../image/v6.png" class="personal_image {{selectArea ? 'rotateRight' :''}}"></image> //三目法判斷圖片要不要旋轉(zhuǎn)180。 </view> <view class="person_box"> <view class="phone_select" hidden="{{selectPerson}}"> <view bindtap="mySelect">測(cè)試1</view> <view bindtap="mySelect">測(cè)試2</view> <view bindtap="mySelect">測(cè)試3</view> </view> </view>
index.js
Page({ data:{ selectPerson:true, firstPerson:'個(gè)人', selectArea:false, }, //點(diǎn)擊選擇類型 clickPerson:function(){ var selectPerson = this.data.selectPerson; if(selectPerson == true){ this.setData({ selectArea:true, selectPerson:false, }) }else{ this.setData({ selectArea:false, selectPerson:true, }) } } , //點(diǎn)擊切換 mySelect:function(e){ this.setData({ firstPerson:e.target.dataset.me, selectPerson:true, selectArea:false, }) }, }}
index.wxss
.phone_personal{ width: 100%; color:rgb(34, 154, 181); height:100rpx; line-height:100rpx; text-align: center; } .phone_one{ display: flex; //用flex布局更方便。 position: relative; justify-content: space-between; background-color:rgb(239, 239, 239); width:90%; height:100rpx; margin:0 auto; border-radius: 10rpx; border-bottom:2rpx solid rgb(255, 255, 255); } .person_box{ position: relative; } .phone_select{ margin-top:0; z-index: 100; position: absolute; //小程序中z-index和absolute需要同時(shí)存在,元素才能脫離文檔。 } .select_one{ text-align: center; background-color:rgb(239, 239, 239); width:676rpx; //脫離文檔后元素width不能再用百分比。 height:100rpx; line-height:100rpx; margin:0 5%; border-bottom:2rpx solid rgb(255, 255, 255); } .personal_image{ z-index: 100; position: absolute; right:2.5%; width: 34rpx; height: 20rpx; margin:40rpx 20rpx 40rpx 0; transition: All 0.4s ease; -webkit-transition: All 0.4s ease; } .rotateRight{ transform: rotate(180deg); //180°旋轉(zhuǎn)圖片。 }
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- 微信小程序?qū)崿F(xiàn)圖片翻轉(zhuǎn)效果的實(shí)例代碼
- 詳解微信小程序圖片地扯轉(zhuǎn)base64解決方案
- 微信小程序點(diǎn)擊圖片實(shí)現(xiàn)長(zhǎng)按預(yù)覽、保存、識(shí)別帶參數(shù)二維碼、轉(zhuǎn)發(fā)等功能
- 微信小程序內(nèi)拖動(dòng)圖片實(shí)現(xiàn)移動(dòng)、放大、旋轉(zhuǎn)的方法
- 微信小程序 Animation實(shí)現(xiàn)圖片旋轉(zhuǎn)動(dòng)畫示例
- 小程序圖片剪裁加旋轉(zhuǎn)的示例代碼
- 小程序點(diǎn)擊圖片實(shí)現(xiàn)png轉(zhuǎn)jpg
相關(guān)文章
微信小程序 導(dǎo)入圖標(biāo)實(shí)現(xiàn)過(guò)程詳解
這篇文章主要介紹了微信小程序 導(dǎo)入圖標(biāo)實(shí)現(xiàn)過(guò)程詳解,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-10-10詳解JS 比較兩個(gè)Json對(duì)象的值是否相等的實(shí)例
這篇文章主要介紹了JS 比較兩個(gè)Json對(duì)象的值是否相等的實(shí)例,有需要的朋友可以參考一下2013-11-11Javascript合并表格中具有相同內(nèi)容單元格示例
表格相同內(nèi)容單元格的合并在以前也有過(guò)類似的教程,本文為大家講解的是使用Javascript合并,具體示例及效果圖如下,感興趣的朋友可以參考下2013-08-08可以用鼠標(biāo)拖動(dòng)的DIV實(shí)現(xiàn)思路及代碼
DIV可以拖動(dòng)的效果,想必大家都有見到過(guò)吧,在本文也為大家實(shí)現(xiàn)一個(gè)不錯(cuò)的可以用鼠標(biāo)拖動(dòng)的div,感興趣的各位不要錯(cuò)過(guò)2013-10-10