File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 371371 if ( input . is ( ":disabled" ) || e . target == handle [ 0 ] ) {
372372 return e . preventDefault ( ) ;
373373 }
374-
374+ init ( ) ;
375375 var fix = handle . width ( ) / 2 ;
376376 slide ( e , vertical ? len - origo - fix + e . pageY : e . pageX - origo - fix ) ;
377377 } ) ;
Original file line number Diff line number Diff line change 3131 prev : '.prev' ,
3232 speed : 400 ,
3333 vertical : false ,
34+ touch : true ,
3435 wheelSpeed : 0
3536 }
3637 } ;
256257 } ) ;
257258 }
258259
260+ // touch event
261+ if ( conf . touch ) {
262+ var touch = { } ;
263+
264+ itemWrap [ 0 ] . ontouchstart = function ( e ) {
265+ var t = e . touches [ 0 ] ;
266+ touch . x = t . clientX ;
267+ touch . y = t . clientY ;
268+ } ;
269+
270+ itemWrap [ 0 ] . ontouchmove = function ( e ) {
271+
272+ // only deal with one finger
273+ if ( e . touches . length == 1 && ! itemWrap . is ( ":animated" ) ) {
274+ var t = e . touches [ 0 ] ,
275+ deltaX = touch . x - t . clientX ,
276+ deltaY = touch . y - t . clientY ;
277+
278+ self [ vertical && deltaY > 0 || ! vertical && deltaX > 0 ? 'next' : 'prev' ] ( ) ;
279+ e . preventDefault ( ) ;
280+ }
281+ } ;
282+ }
283+
259284 if ( conf . keyboard ) {
260285
261286 $ ( document ) . bind ( "keydown.scrollable" , function ( evt ) {
You can’t perform that action at this time.
0 commit comments