summaryrefslogtreecommitdiff
path: root/xstatic/pkg/spin/data/spin.jquery.js
blob: 14975d0e24dfb374df083e2a700c53be4c279040 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// jQuery add-on for allowing spin.js to act on jQuery elements directly.

$.fn.spin = function(opts) {
  this.each(function() {
    var $this = $(this),
        data = $this.data();

    if (data.spinner) {
      data.spinner.stop();
      delete data.spinner;
    }
    if (opts !== false) {
      data.spinner = new Spinner($.extend({color: $this.css('color')}, opts)).spin(this);
    }
  });
  return this;
};