   _onAnimationEnd: (event) =>
     state = @el.attr "data-state"
     @trigger state
-    @trigger (if state in ["in", "back-out"] then "active" else "inactive")
+    if state in ["in", "back-out"]
+      @trigger "active"
+    else if state in ["out", "back-in"]
+      @trigger "inactive"
     @el.removeAttr "data-state" unless state in ["aside-in"]
 
     unless state in ["in", "back-out", "aside-in", "aside-out"] then @el.removeClass "active"


  section: (id) ->
    @el.children("##{id}").addClass("active").siblings().removeClass("active")

  aside: (id) ->
    state = @el.attr("data-state")
    if state?
      Atoms.App.Aside[@attributes.aside].out()
    else
      Atoms.App.Aside[@attributes.aside].in()
    @el.removeAttr("data-state")
    setTimeout =>
      @state if state is "aside-in" then "aside-out" else "aside-in"

    @el.bind Atoms.Core.Constants.ANIMATION.END, @_onAnimationEnd

  in: ->
   @state "in"

  out: ->
    @state "out"
