                                                 :x x})))
 
 (defn get-current-position [event]
-  (+ (.-x (.-contentOffset (.-nativeEvent event))) (quot (page-width) 2)))
+  (.-x (.-contentOffset (.-nativeEvent event))))
 
-(defn on-scroll-end [event component]
+(defn on-scroll-end [event component starting-position]
   (let [props (reagent.core/props component)
         state (reagent.core/state component)
         prop-page-width (get-page-width props)
         sneak (get-sneak props)
+        scroll-threshold (get-scroll-threshold props)
         gap (get-gap state)
         page-offset (+ prop-page-width gap)
         current-position (get-current-position event)
-        current-page (quot current-position page-offset)
+        direction (if (> current-position (+ starting-position scroll-threshold))
+                    1
+                    (if (< current-position (- starting-position scroll-threshold))
+                      -1
+                      0))
+        current-page (+ (quot starting-position page-offset) direction)
         ]
     (log/debug "on-scroll-end: prop-page-width=" prop-page-width
                "; sneak=" sneak "; gap=" gap "; page-offset=" page-offset
+               "; starting position=" starting-position
                "; current-position=" current-position
-               "; current-page=" current-page)
+               "; direction=" direction "; current-page=" current-page)
     (scroll-to component (* current-page page-offset) 0)
     (reagent.core/set-state component {:activePage current-page})
     (when (:onPageChange props)


(defn get-page-width [data]
  (get data :pageWidth (:pageWidth defaults)))

(defn calculate-gap [component props]
  (let [prop-page-width (get-page-width props)


(def defaults {:gap 10
               :sneak 10
               :pageWidth (- (page-width) 40)
               :scrollThreshold 20})


(defn get-gap [data]
