/ Published in: JavaScript
requires mootools
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* Function in class */ prepareLabels: function(dataProperty,defaultEvent){ var i = 0; $each(stageLabels,function(listElement){ listElement.setProperty(dataProperty,i); listElement.addEvent(defaultEvent,function(e){ /* changeImage => other function in class */ this.changeImage(e.target); }.bind(this)); /* bind -> sets function-context */ i++; },this); }