File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -135,18 +135,20 @@ $(function () {
135135 var mask = $ ( '#mask' ) ;
136136 var weuiActionsheet = $ ( '#weui_actionsheet' ) ;
137137 weuiActionsheet . addClass ( 'weui_actionsheet_toggle' ) ;
138- mask . show ( ) . addClass ( 'weui_fade_toggle' ) . one ( 'click' , function ( ) {
138+ mask . show ( )
139+ . focus ( ) //加focus是为了触发一次页面的重排(reflow or layout thrashing),使mask的transition动画得以正常触发
140+ . addClass ( 'weui_fade_toggle' ) . one ( 'click' , function ( ) {
139141 hideActionSheet ( weuiActionsheet , mask ) ;
140142 } ) ;
141143 $ ( '#actionsheet_cancel' ) . one ( 'click' , function ( ) {
142144 hideActionSheet ( weuiActionsheet , mask ) ;
143145 } ) ;
144- weuiActionsheet . unbind ( 'transitionend' ) . unbind ( 'webkitTransitionEnd' ) ;
146+ mask . unbind ( 'transitionend' ) . unbind ( 'webkitTransitionEnd' ) ;
145147
146148 function hideActionSheet ( weuiActionsheet , mask ) {
147149 weuiActionsheet . removeClass ( 'weui_actionsheet_toggle' ) ;
148150 mask . removeClass ( 'weui_fade_toggle' ) ;
149- weuiActionsheet . on ( 'transitionend' , function ( ) {
151+ mask . on ( 'transitionend' , function ( ) {
150152 mask . hide ( ) ;
151153 } ) . on ( 'webkitTransitionEnd' , function ( ) {
152154 mask . hide ( ) ;
Original file line number Diff line number Diff line change @@ -135,18 +135,20 @@ $(function () {
135135 var mask = $ ( '#mask' ) ;
136136 var weuiActionsheet = $ ( '#weui_actionsheet' ) ;
137137 weuiActionsheet . addClass ( 'weui_actionsheet_toggle' ) ;
138- mask . show ( ) . addClass ( 'weui_fade_toggle' ) . one ( 'click' , function ( ) {
138+ mask . show ( )
139+ . focus ( ) //加focus是为了触发一次页面的重排(reflow or layout thrashing),使mask的transition动画得以正常触发
140+ . addClass ( 'weui_fade_toggle' ) . one ( 'click' , function ( ) {
139141 hideActionSheet ( weuiActionsheet , mask ) ;
140142 } ) ;
141143 $ ( '#actionsheet_cancel' ) . one ( 'click' , function ( ) {
142144 hideActionSheet ( weuiActionsheet , mask ) ;
143145 } ) ;
144- weuiActionsheet . unbind ( 'transitionend' ) . unbind ( 'webkitTransitionEnd' ) ;
146+ mask . unbind ( 'transitionend' ) . unbind ( 'webkitTransitionEnd' ) ;
145147
146148 function hideActionSheet ( weuiActionsheet , mask ) {
147149 weuiActionsheet . removeClass ( 'weui_actionsheet_toggle' ) ;
148150 mask . removeClass ( 'weui_fade_toggle' ) ;
149- weuiActionsheet . on ( 'transitionend' , function ( ) {
151+ mask . on ( 'transitionend' , function ( ) {
150152 mask . hide ( ) ;
151153 } ) . on ( 'webkitTransitionEnd' , function ( ) {
152154 mask . hide ( ) ;
You can’t perform that action at this time.
0 commit comments