Skip to content

Instantly share code, notes, and snippets.

@dcalhoun
Created August 7, 2012 15:58
Show Gist options
  • Save dcalhoun/3286636 to your computer and use it in GitHub Desktop.
Save dcalhoun/3286636 to your computer and use it in GitHub Desktop.
Spin.js jQuery Function
jQuery.fn.spin = (opts) ->
if opts != false
opts =
className: 'js-spinner'
lines: 13
length: 5
width: 3
radius: 7
speed: 1.2
trail: 50
shadow: false
hwaccel: true
this.each ->
$this = $(this)
data = $this.data()
if data.spinner
data.spinner.stop()
delete data.spinner
data.spinner = new Spinner($.extend({color: $this.css('color')}, opts)).spin(this) if opts != false
this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment