jquery.cssanim.coffee 975 B

123456789101112131415161718192021
  1. jQuery.fn.cssSlideDown = ->
  2. elem = @
  3. elem.css({"opacity": 0, "margin-bottom": 0, "margin-top": 0, "padding-bottom": 0, "padding-top": 0, "display": "none", "transform": "scale(0.8)"})
  4. setTimeout (->
  5. elem.css("display", "")
  6. height = elem.outerHeight()
  7. elem.css({"height": 0, "display": ""}).cssLater("transition", "all 0.3s ease-out", 20)
  8. elem.cssLater({"height": height, "opacity": 1, "margin-bottom": "", "margin-top": "", "padding-bottom": "", "padding-top": "", "transform": "scale(1)"}, null, 40)
  9. elem.cssLater({"transition": "", "transform": ""}, null, 1000, "noclear")
  10. ), 10
  11. return @
  12. jQuery.fn.fancySlideDown = ->
  13. elem = @
  14. elem.css({"opacity": 0, "transform":"scale(0.9)"}).slideDown().animate({"opacity": 1, "scale": 1}, {"duration": 600, "queue": false, "easing": "easeOutBack"})
  15. jQuery.fn.fancySlideUp = ->
  16. elem = @
  17. elem.delay(600).slideUp(600).animate({"opacity": 0, "scale": 0.9}, {"duration": 600, "queue": false, "easing": "easeOutQuad"})