Skip to content

Instantly share code, notes, and snippets.

@vlado
Created November 28, 2013 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vlado/7697906 to your computer and use it in GitHub Desktop.
Save vlado/7697906 to your computer and use it in GitHub Desktop.
// Usage:
// $('div').gracefullEffect('slideDown')
$.fn.gracefullEffect = function(effectName) {
fallbacksMap = {
slideDown: 'show',
slideUp: 'hide'
// ...
}
if ($.support.trailingWhiteSpace) {
$(this)[effectName]()
} else {
effect = fallbacksMap[effectName]
$(this)[effect]()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment