diff --git a/package.json b/package.json index 272492a..0a17810 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salet", - "version": "1.5.1", + "version": "1.5.2", "description": "A general client-side framework for cybertext interactive fiction games.", "keywords": ["ifiction", "interactive fiction", "games", "coffee-script", "text", "menu"], "homepage": "http://salet.oreolek.ru", diff --git a/src/view.coffee b/src/view.coffee index ec1e55e..2391776 100644 --- a/src/view.coffee +++ b/src/view.coffee @@ -244,13 +244,17 @@ class SaletView # A function to play CSS animation on a block. # Implies the effect is one-time, not infinite. - # @param block - jQuery object - # @param effect - animate.css effect to call + # @param block - jQuery object or selector + # @param effect - css effect to call # @param after - a callback function to execute after the animation is done @animateBlock = (block, effect, after = undefined) -> + block = jQuery(block) animation = block.css("animation-name") or block.css("-moz-animation-name") or block.css("-webkit-animation-name") if animation @clearAnimation(block) + if not after? + after = (event) -> + salet.view.clearAnimation(event.target) block.addClass("animated") block.addClass(effect)