Skip to content

Commit

Permalink
Call widget instance "widget"
Browse files Browse the repository at this point in the history
  • Loading branch information
skhilko committed Apr 19, 2015
1 parent cdfdc6b commit bea493d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/scripts/jquery-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ function Plugin(element, options) {
}

Plugin.prototype.init = function() {
this.akno = new StickyHeaders(this.element, this.options);
this.widget = new StickyHeaders(this.element, this.options);
};

Plugin.prototype.destroy = function() {
this.akno.destroy();
this.widget.destroy();
$.removeData(this.element, 'plugin_' + pluginName);
this.element = null;
};
Expand All @@ -30,8 +30,8 @@ $.fn[pluginName] = function(options) {
var instance = $.data(this, dataKey);
if (instance instanceof Plugin) {
// call with the widget instance if not on the plugin
if(!$.isFunction(instance[options]) && $.isFunction(instance.akno[options])) {
instance = instance.akno;
if(!$.isFunction(instance[options]) && $.isFunction(instance.widget[options])) {
instance = instance.widget;
}
instance[options].apply(instance, Array.prototype.slice.call(args, 1));
}
Expand Down

0 comments on commit bea493d

Please sign in to comment.