   componentWillUnmount: ->
     window.removeEventListener 'keydown', @onPressSpaceBar
 
-  zoomImage: (preview) ->
+  zoomImage: (i, preview) ->
+    @setState zoomImageCurrent: i
     @setState zoomImageSrc: preview
     @refs.imageZoom.show() if window.innerWidth > 600
 

    previews =
      @props.previews?.map (preview, i) =>
        <figure key={i}>
          <img src={preview} onLoad={@onImageLoad.bind(@, null)} onClick={@zoomImage.bind(null, preview) if window.innerWidth > 600} />
        </figure>

    source = if @isFirefox then @props.video.webm else @props.video.mp4

      @overlay.classList.remove 'fade-out'

      @refs.imageZoom.hide()
      @setState zoomImageCurrent: null
      @setState zoomImageSrc: null
      @overlay.removeEventListener 'click', @closeZoom
      window.removeEventListener 'keydown', @onPressKeyInZoom
    ), 250

  onPressKeyInZoom: (e) ->
    if e.keyCode is 37 or e.keyCode is 39
      e.preventDefault()

      i = @state.zoomImageCurrent
      if e.keyCode is 37
        i = (i - 1) % @props.previews.length
      else
        i = (i + 1) % @props.previews.length

      @zoomImage(i, @props.previews[i])

  onImageLoad: (i, event) ->
    if @loadCount < @props.previews.length
