Home > Mobile >  Fake friends optimized version, thumb up comments animation code sharing
Fake friends optimized version, thumb up comments animation code sharing

Time:11-30

//1. Animation js,

//thumb up method
TouchDiscuss: function (e) {
Var that=this
//this. Data isShow=! This. Data. IsShow
//animation
Var dz_id=e.c. with our fabrication: urrentTarget. Dataset. Id
Var indexs=e.c. with our fabrication: urrentTarget. Dataset. Indexs
Var detailY=e.d etail. Y
Var offsetNum=e. arget. OffsetTop

//the first part explain
If (Number (detailY) & lt;=(offsetNum + 21) | | Number (detailY) & gt;=(offsetNum - 1)) {
DetailY=offsetNum + 9
Enclosing setData ({
DetailY: detailY,
Event: e,
Dz_id: dz_id,
Indexs: indexs
})
}

//var animations=this. Data. Animation
//Settings click on another person's thumb up after the person's thumb up window
If (that) the data) isShow==1) {
That the setData ({
PopTop: e. arget. OffsetTop - (detailY - e. arget. OffsetTop)/2,
PopWidth: 0,
IsShow: 0,

})


SetTimeout (function () {
That. The animation. The width (0). The opacity (1). Step ()
That the setData ({
Animation: that. Animation. The export (),
})
}, 100)
SetTimeout (function () {
That the setData ({
Dianzan1: ", "
Pinglun1: ""
})
}, 110)
} else if (that) the data) isShow==0) {
Enclosing openit ()
}
},

Openit: function () {

Var that=this
Var event=this. Data. The event
Var detailY=this. Data. DetailY
Var dianzaiID=event. The currentTarget. Dataset. Dianzan
Var nowdianzaiID=this. Data. The openId
SetTimeout (function () {
That. Animation. Height (33). Opacity (1)
That. The animation. The width (170). Opacity (1). Step ()

That the setData ({
Animation: that. Animation. The export (),
})
}, 100)

That the setData ({
PopTop: event. The target. The offsetTop - (detailY - event. The target. The offsetTop)/2,
PopWidth: 0,
IsShow: 1,

})
SetTimeout (function () {
If (dianzaiID indexOf (nowdianzaiID) & gt;=0) {
That the setData ({
Dianzan1: "cancel",
})
} else {
That the setData ({
Dianzan1: "thumb up",
})
}
That the setData ({

Pinglun1: "comment"
})
}, 300)


},

//animation WXML part (animation WXML)







//animation WXML part (animation WXSS)
. Pop - up - box {
Position: absolute;
Height: the RPX 60;
Border - the radius: 10 the RPX;
Right: the RPX 91;
Background: rgba (0, 0, 0, 0.7)
}
//animation WXML part (thumb up button)


  • Related