1 // https://gist.github.com/its-florida/1290439/raw/ce7face0309bdb265244e8483ce91dcf86e8cb14/jquery.spin.js
4 You can now create a spinner using any of the variants below:
6 $("#el").spin(); // Produces default Spinner using the text color of #el.
7 $("#el").spin("small"); // Produces a 'small' Spinner using the text color of #el.
8 $("#el").spin("large", "white"); // Produces a 'large' Spinner in white (or any valid CSS color).
9 $("#el").spin({ ... }); // Produces a Spinner using your custom settings.
11 $("#el").spin(false); // Kills the spinner.
15 $.fn.spin = function(opts, color) {
17 "tiny": { lines: 8, length: 2, width: 2, radius: 3 },
18 "small": { lines: 8, length: 4, width: 3, radius: 5 },
19 "large": { lines: 10, length: 8, width: 4, radius: 8 }
22 return this.each(function() {
31 if (typeof opts === "string") {
32 if (opts in presets) {
41 data.spinner = new Spinner($.extend({color: $this.css('color')}, opts)).spin(this);
45 throw "Spinner class not available.";