lib/assets/javascripts/tao/ui/shared/slide_box/element/base.coffee in tao_ui-0.2.9 vs lib/assets/javascripts/tao/ui/shared/slide_box/element/base.coffee in tao_ui-0.2.10

- old
+ new

@@ -46,37 +46,41 @@ @triggerEl.on "click.tao-slide-box-#{@taoId}", (e) => @active = true _beforeActiveChanged: (active) -> if active + @namespacedTrigger 'beforeShow' @jq.show() @reflow() else + @namespacedTrigger 'beforeHide' reset = => if @autoDestroy @remove() else @jq.hide() + @namespacedTrigger 'afterHide' # in case the slide box is hidden too fast if @jq.is(':visible') - if @jq.css('opacity') * 1 == 0 + @on 'transitionend', (e) => + return unless $(e.target).is('.slide-box-wrapper') + @off 'transitionend' reset() - else - @one 'transitionend', -> - reset() + else + reset() null _activeChanged: -> @_unbindAutoHideEvent() if @autoHide if @active @_bindAutoHideEvent() if @autoHide $('body').addClass('slide-box-active') - @trigger 'tao:show' + @namespacedTrigger 'show' else $('body').removeClass('slide-box-active') - @trigger 'tao:hide' + @namespacedTrigger 'hide' _autoHideEvent: '' _unbindAutoHideEvent: -> $(document).off "#{@_autoHideEvent}.tao-slide-box-#{@taoId}" @@ -86,12 +90,12 @@ return if e.target == @ || $.contains(@, e.target) || @triggerEl?.is(e.target) @active = false @_unbindAutoHideEvent() remove: -> - @trigger 'tao:beforeRemove' + @namespacedTrigger 'beforeRemove' @jq.remove() - @trigger 'tao:remove' + @namespacedTrigger 'remove' @ beforeCache: -> if @autoDestroy @remove()