1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
function init() {
$$('.ed_zone').each( function(e) {
new ImageZone(e);
});
}
var ImageZone = Class.create();
ImageZone.prototype = {
initialize: function(e) {
this.element = e;
Event.observe(e, 'mouseover', this.handleMouseOver.bindAsEventListener(this));
Event.observe(e, 'mouseout', this.handleMouseOut.bindAsEventListener(this));
Event.observe(e, 'click', this.handleClick.bindAsEventListener(this));
},
handleMouseOver: function(event) {
this.element.addClassName('ed_highlight');
},
handleMouseOut: function(event) {
this.element.removeClassName('ed_highlight');
},
handleClick: function(event) {
...
}
} |
Partager