Giter Site home page Giter Site logo

Comments (8)

fgnass avatar fgnass commented on June 3, 2024

The defaults already get merged into the provided options object inside the Spinner constructor:
https://github.com/fgnass/spin.js/blob/gh-pages/spin.js#L142

The jQuery plugin only calls $.exdend in order to fill in the runtime-color in case no color value has been explicitly specified.

from spin.js.

jblotus avatar jblotus commented on June 3, 2024

the issue is that that jquery plugin featured on the spin.js demo page wont
run unless you provide defaults explicitly.

On Wed, Mar 21, 2012 at 10:50 AM, Felix Gnass <
[email protected]

wrote:

The defaults already get merged into the provided options object inside
the Spinner constructor:
https://github.com/fgnass/spin.js/blob/gh-pages/spin.js#L142

The jQuery plugin only calls $.exdend in order to fill in the
runtime-color in case no color value has been explicitly specified.


Reply to this email directly or view it on GitHub:
#59 (comment)

from spin.js.

jblotus avatar jblotus commented on June 3, 2024

the issue is that that jquery plugin featured on the spin.js demo page wont run unless you provide defaults explicitly.

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

from spin.js.

jblotus avatar jblotus commented on June 3, 2024

i didn't realize the spin.js merged in options already. still there is a problem with the jquery plugin. it could be rewritten like so:

$.fn.spin = function(opts) {

  this.each(function() {
    var $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);
  });
  return this;
};

from spin.js.

fgnass avatar fgnass commented on June 3, 2024

I'm not sure what you mean. Here's an example that uses the jQuery plugin from the spin.js homepage: http://fgnass.github.com/spin.js/example/jquery.html

It works also when no options are passed at all. What problem exactly are you experiencing?

from spin.js.

jblotus avatar jblotus commented on June 3, 2024

your example clearly works. we were having trouble with it on our project. i will let you know what happened as soon as i can put together a test case.

thanks!

from spin.js.

fgnass avatar fgnass commented on June 3, 2024

You're welcome. I'll leave this issue open so that you can come back and post your test case.

from spin.js.

jblotus avatar jblotus commented on June 3, 2024

I have just tried to reconstruct the issue but I have failed. Looking more closely at the code, opts === false will still run if opts is undefined.

I think this was a red herring. Sorry to waste your time!

from spin.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.