Why are custom events not working for me? (Mootools)?

The problem is with this line: this.pushIn. Bind(el) When pushIn is called this refers to the li element that was hovered, and not an object of Pusher So calling this. FireEvent('in') will fire the event on the li element, instead of your class' object.

The DOM event object contains the target which refers to the element that triggered the event. Using this target property, we can get the element that triggered the event, and then animate it Side note: when the mouse(over|out) event is triggered this already refers to the DOM object, so you don't have to bind it explicitly with bind(el) Made the following things to your code: bound event handlers to object of Pusher use event. Target to animate the li DOM element example on jsf attachListeners: function(elements){ $$(elements).

Each(function(el){ $(el). AddEvent('mouseover', this.pushIn. Bind(this)) .

AddEvent('mouseout', this.pushOut. Bind(this)) }, this); }, pushIn: function(event) { this. FireEvent('in'); var item = event.

Target; item. Set('tween', {duration: 'short'}); item. Tween('paddingLeft', '50px'); }, pushOut: function(event){ var item = event.

Target; this. FireEvent('out'); item. Set('tween', {duration: 'short'}); item.

Tween('paddingLeft', '0px'); }.

The problem is with this line: this.pushIn. Bind(el) When pushIn is called, this refers to the element that was hovered, and not an object of Pusher. So calling this.

FireEvent('in') will fire the event on the element, instead of your class' object. The DOM event object contains the target which refers to the element that triggered the event. Using this target property, we can get the element that triggered the event, and then animate it.

Side note: when the mouse(over|out) event is triggered, this already refers to the DOM object, so you don't have to bind it explicitly with . Bind(el). Made the following things to your code: bound event handlers to object of Pusher use event.

Target to animate the DOM element example on jsf attachListeners: function(elements){ $$(elements). Each(function(el){ $(el). AddEvent('mouseover', this.pushIn.

Bind(this)) . AddEvent('mouseout', this.pushOut. Bind(this)) }, this); }, pushIn: function(event) { this.

FireEvent('in'); var item = event. Target; item. Set('tween', {duration: 'short'}); item.

Tween('paddingLeft', '50px'); }, pushOut: function(event){ var item = event. Target; this. FireEvent('out'); item.

Set('tween', {duration: 'short'}); item. Tween('paddingLeft', '0px'); }.

Fantastic, what a great answer. Thank you! – John McCollum Apr 25 '10 at 18:15 glad it worked for you.

Cheers! – Anurag Apr 25 '10 at 22:09.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions