File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -299,14 +299,28 @@ An instance of Slideout emits the following events:
299299- ` close `
300300- ` beforeopen `
301301- ` open `
302+ - ` translatestart `
302303- ` translate `
304+ - ` translateend `
303305
304- The slideout emits ` translate ` event only when it is opening/closing via touch events.
306+ The slideout emits ` translatestart ` , ` translate ` and ` translateend ` events only when it is opening/closing via touch events.
305307
306308``` js
309+ slideout .on (' translatestart' , function () {
310+ console .log (' Start' );
311+ });
312+
307313slideout .on (' translate' , function (translated ) {
308- console .log (translated); // 120 in px
314+ console .log (' Translate: ' + translated); // 120 in px
309315});
316+
317+ slideout .on (' translateend' , function () {
318+ console .log (' End' );
319+ });
320+
321+ // 'Start'
322+ // 'Translate 120'
323+ // 'End'
310324```
311325
312326## npm-scripts
Original file line number Diff line number Diff line change @@ -218,6 +218,7 @@ Slideout.prototype._initTouchEvents = function() {
218218 */
219219 this . _onTouchEndFn = function ( ) {
220220 if ( self . _moved ) {
221+ self . emit ( 'translateend' ) ;
221222 ( self . _opening && Math . abs ( self . _currentOffsetX ) > self . _tolerance ) ? self . open ( ) : self . close ( ) ;
222223 }
223224 self . _moved = false ;
@@ -251,6 +252,10 @@ Slideout.prototype._initTouchEvents = function() {
251252 return ;
252253 }
253254
255+ if ( ! self . _moved ) {
256+ self . emit ( 'translatestart' ) ;
257+ }
258+
254259 if ( oriented_dif_x <= 0 ) {
255260 translateX = dif_x + self . _padding * self . _orientation ;
256261 self . _opening = false ;
You can’t perform that action at this time.
0 commit comments