Skip to content

Instantly share code, notes, and snippets.

@fredsterss
Created June 4, 2013 00:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredsterss/5702577 to your computer and use it in GitHub Desktop.
Save fredsterss/5702577 to your computer and use it in GitHub Desktop.
Elegant loading
# handle ajax events (loading and auth errors)
$(document).ajaxStart ->
settings = lines: 12, length: 6, width: 4, radius: 8, trail: 75, color: '#fff'
$('.loading-main').html new r.ui.spinner( settings ).spin().el
$('[data-section=logo]').addClass('loading')
$(document).ajaxStop ->
$('[data-section=logo]').removeClass('loading')
$(document).ajaxComplete (e, xhr, options) ->
r.errorHandler.handle(xhr)
@kirillzubovsky
Copy link

Open Source this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment