     return
 
   addEvent slider, 'transitionend', ->
-    removeClass slider, 'animated'
+    removeClass slider, choco_animated
     return
 
   addEvent slider, 'webkitTransitionEnd', ->
-    removeClass slider, 'animated'
+    removeClass slider, choco_animated
     return
 
-  finish = =>
-    removeClass overlay, 'animated'
-    return unless isClosing
 
-    @close()
-    transparent 1
-
-    return
-
-  addEvent overlay, 'transitionend', =>
+  addEvent overlay, 'transitionend', ->
     finish()
     return
 
-  addEvent overlay, 'webkitTransitionEnd', =>
+  addEvent overlay, 'webkitTransitionEnd', ->
     finish()
     return
 
-  # addEvent overlay, 'touchend', (event) ->
-  #   touch.end()
-  #
-  # addEvent overlay, 'touchcancel', (event) ->
-  #   touch.cancel()
-  #
-  # addEvent overlay, 'touchleave', (event) ->
-  #   touch.end()
-
-
-
-
-  t = new Touch overlay,
-    start: (t) ->
-      return false
-
-    move: (t) =>
-      s = getOffset slider
-
-      dx = Math.abs(t.x0 - t.x)
-      dy = Math.abs(t.y0 - t.y)
-
-      if dx > dy
-        isThumbing = true
-        isClosing = false
-        transparent 1
-        translate slider, s + t.dx
-      else
-        isClosing = true
-        isThumbing = false
-        transparent Math.round((1 - dy / env.h) * 100) / 100
-      true
-
-    end: (t) =>
-      if isThumbing
-        addClass slider, 'animated'
-        max = @storage.length() - 1 if max is -1
-        s = getOffset slider
-        s = touchShift t, (s / env.w)
-        @select squeeze s, 0, max
-      if isClosing
-        addClass overlay, 'animated'
-        if opacity < 0.7
-          transparent 0
-        else
-          transparent 1
-          isClosing = false
-      false
+  addEvent overlay, 'touchstart', start
+  addEvent overlay, 'touchmove', move
+  addEvent overlay, 'touchend', end
+  addEvent overlay, 'touchcancel', end
+  addEvent overlay, 'touchleave', end
 
   return true
 


  return toInt transform

touchShift = do ->
  length = window.innerHeight * 0.25



  addClass overlay, 'touch'

  finish = =>
    console.log @
    removeClass overlay, choco_animated
    return unless isClosing

    @close()
    transparent 1

    return


  finger = {}

  start = (event) ->
    return if event.changedTouches.length isnt 1

    t = captureFinger event.changedTouches.item 0
    return unless t
    finger[key] = value for own key, value of t
    finger.x0 = finger.x
    finger.y0 = finger.y

  move = (event) ->
    t = captureFinger getTouch event.changedTouches, finger.id
    return unless t

    t.dx = (t.x - finger.x) || 0
    t.dy = (t.y - finger.y) || 0
    finger.x = t.x
    finger.y = t.y
    t.x0 = finger.x0
    t.y0 = finger.y0

    s = getOffset slider

    dx = Math.abs(t.x0 - t.x)
    dy = Math.abs(t.y0 - t.y)

    if dx > dy
      isThumbing = true
      isClosing = false
      transparent 1
      translate slider, s + t.dx
    else
      isClosing = true
      isThumbing = false
      transparent Math.round((1 - dy / env.h) * 100) / 100
    stop event

  end = (event) =>
    t = captureFinger getTouch event.changedTouches, finger.id
    return unless t
    t.dx = (t.x - finger.x) || 0
    t.dy = (t.y - finger.y) || 0
    t.x0 = finger.x0
    t.y0 = finger.y0
    if isThumbing
      addClass slider, choco_animated
      max = @storage.length() - 1 if max is -1
      s = getOffset slider
      s = touchShift t, (s / env.w)
      @select squeeze s, 0, max
    if isClosing
      addClass overlay, choco_animated
      if opacity < 0.7
        transparent 0
      else
        transparent 1
        isClosing = false

  addEvent slider, 'click', (event) ->
    stop event
    return
