be-fe / iSlider

Smooth mobile touch slider for Mobile WebApp, HTML5 App, Hybrid App
http://be-fe.github.io/iSlider/
MIT License
1.65k stars 449 forks source link

为注册事件回调增加链式调用 #371

Closed marginTop closed 8 years ago

marginTop commented 8 years ago
iSliderPrototype.on = function (eventName, func, force) {
        if (inArray(eventName, iSlider.EVENTS) && typeof func === 'function') {
            !(eventName in this.events) && (this.events[eventName] = []);
            if (!force) {
                this.events[eventName].push(func);
            } else {
                this.events[eventName].unshift(func);
            }
        }

       // 平时写on的时候连着写会爽一点
        return this;
    };

修改了个错别字