@@ -35,6 +35,7 @@ var kScrollToTime = 12;
35
35
36
36
var isWebkit = "webkitTransform" in document . documentElement . style ;
37
37
var isFirefox = "MozTransform" in document . documentElement . style ;
38
+ var isTouch = "ontouchstart" in window ;
38
39
39
40
// ===============================================================================================
40
41
@@ -71,10 +72,11 @@ window.scrollability = {
71
72
touchTargets = [ target ] ;
72
73
touchMoved = true ;
73
74
if ( animationTime ) {
74
- // XXXjoe Support horizontal if that is the axis of element
75
75
var orig = element [ target . key ] ;
76
+ var dest = target . filter ( x , y ) ;
77
+
76
78
animationInterval = setInterval ( function ( ) {
77
- target . updater ( orig + ( ( y - orig ) * ( t / animationTime ) ) ) ;
79
+ target . updater ( orig + ( ( dest - orig ) * ( t / animationTime ) ) ) ;
78
80
if ( ++ t > animationTime ) {
79
81
clearInterval ( animationInterval ) ;
80
82
setTimeout ( stopAnimation , 200 ) ;
@@ -96,7 +98,7 @@ function onScroll(event) {
96
98
setTimeout ( function ( ) {
97
99
if ( justChangedOrientation ) {
98
100
justChangedOrientation = false ;
99
- } else {
101
+ } else if ( isTouch ) {
100
102
var scrollables = document . getElementsByClassName ( 'scrollable' ) ;
101
103
if ( scrollables . length ) {
102
104
var scrollable = scrollables [ 0 ] ;
0 commit comments