staaky/spinners

error in code

Closed this issue · 1 comments

Hey this sounds cool if I can get it to work.
I am using Chrome

A questions first
I'm assuming I need to bind this to an element like a DIV?
i.e.
new Spinner('spin_div', {
radii: [32, 42],
color: '#ed145b',
dashWidth: 1,
dashes: 75,
opacity: .8,
speed: .7
}).play();

where spin_div is an id of an existing DIV?

Also, I don't want to use prototype because a conflict with JQuery UI is prototype.js required in your example?

When I try to execute this I get the following error:

spinners.js line 360
Uncaught TypeError: Cannot read property 'speed' of undefined

/*

  • Controls

  • play, pause, stop
    */
    function play() {
    if (this._state == 'playing') return;

    this._state = 'playing';

    var ms = this.options.speed * 1000 / this.options.dashes; // Error here
    this._playTimer = window.setTimeout($B.Function.bind(_nextPosition, this), ms);
    return this;
    }

Here is the test page
http://www.myglobalhost.com/BOM/spinners.html

thanks!
Mike Best

You should use the code within the document ready function, that way you make sure the element with id 'spin_div' is there at the time you create a spinner. Also var mySpinner = new Spinner().play(); won't give you anything since there's no first argument.