Skip to content

Instantly share code, notes, and snippets.

@kkxlkkxllb
Created May 3, 2013 06:50
Show Gist options
  • Select an option

  • Save kkxlkkxllb/5507585 to your computer and use it in GitHub Desktop.

Select an option

Save kkxlkkxllb/5507585 to your computer and use it in GitHub Desktop.
class window.Utils
@flash: (msg,type='') ->
$container = $("body")
$container.prepend JST['flash'](msg: msg)
$alert = $(".alert:first-child",$container)
if type isnt ''
$alert.addClass "alert-#{type}"
$alert.css
"-webkit-transform": "scale(0)"
"opacity": "0"
"font-size": "100px"
"-webkit-transition": "1s"
"color":"#333"
fade_in = ->
$alert.css
"-webkit-transform":"scale(1) translateY(170px)"
"opacity": "1"
fade_out = ->
$alert.css
"-webkit-transform":"scale(1.5)"
"opacity": "0.0"
$alert.on "webkitTransitionEnd",->
$(@).remove()
setTimeout fade_in,100
setTimeout fade_out,5000
false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment