Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple bind on prev/next buttons #26

Closed
czgroup opened this issue Aug 21, 2010 · 2 comments
Closed

Multiple bind on prev/next buttons #26

czgroup opened this issue Aug 21, 2010 · 2 comments

Comments

@czgroup
Copy link

czgroup commented Aug 21, 2010

I've recently found, that function buttons is called on every animate event. Thus next and prev events are binded so many times, as many times user clicked at navigation buttons.
I suggest to unbind all handlers of prev/next buttons:
/**
* Sets the states of the prev/next buttons.
*
* @method buttons
* @return undefined
*/
buttons: function(n, p) {
if (n == undefined || n == null) {
var n = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'first') || this.options.size == null || this.last < this.options.size);
if (!this.locked && (!this.options.wrap || this.options.wrap == 'first') && this.options.size != null && this.last >= this.options.size)
n = this.tail != null && !this.inTail;
}

        if (p == undefined || p == null) {
            var p = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'last') || this.first > 1);
            if (!this.locked && (!this.options.wrap || this.options.wrap == 'last') && this.options.size != null && this.first == 1)
                p = this.tail != null && this.inTail;
        }

        var self = this;

/* Start modification /
this.buttonNext.unbind(this.options.buttonNextEvent + '.jcarousel', this.funcNext);
this.buttonPrev.unbind(this.options.buttonPrevEvent + '.jcarousel', this.funcPrev);
/
End modification */
this.buttonNext[n ? 'bind' : 'unbind'](this.options.buttonNextEvent + '.jcarousel', this.funcNext)n ? 'removeClass' : 'addClass'.attr('disabled', n ? false : true);
this.buttonPrev[p ? 'bind' : 'unbind'](this.options.buttonPrevEvent + '.jcarousel', this.funcPrev)p ? 'removeClass' : 'addClass'.attr('disabled', p ? false : true);
},

@jsor
Copy link
Owner

jsor commented Aug 23, 2010

Avoid multiple binds on prev/next buttons (Closed by 167962c)

@jsor
Copy link
Owner

jsor commented Aug 23, 2010

Thanks for the report, your fix has been applied (see previous comment).

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants