jquery plugin - calling methods -
so building first plugin jquery have init method
init: function(options, elem) { var self = this;
this calls couple of methods this.slide(elem); this.lightbox(elem);
however in lightbox method try , call custom method setpositon using
self.setposition(); //error object [object window] has no method 'setposition'
or
this.setposition() // object # has no method 'setposition'
how refer object created?
var myobj = { init: function(){ var self = this; this.alert(); myobj.alert(); self.alert(); }, alert: function(){ alert('im called!'); } };
myobj.init();
see on jsfiddle.
Comments
Post a Comment