Hey guys,
So I want to defer a function of an object, called from within another
function of that object - take a look at my code:
The6YardBox.Dropdown = Class.create({
initialize: function(li)
{
this.li = li;
this.dropdown = this.li.down('div.dropdown-holder');
li.observe('mouseover', this.mover.bind(this));
li.observe('mouseout', this.mout.bind(this));
this.out = true;
},
mover: function()
{
this.out = false;
this.dropdown.show();
},
mout: function()
{
this.out = true;
/* HERE IS THE LINE THAT DOESN'T WORK!!! */ this.actionout.delay
(0.1);
},
actionout: function(out, dropdown)
{
if(this.out)
this.dropdown.hide();
}
});
the actionout function does run after .1 second, but it is not bound
to the object so if(this.out) fails. I've tried all kinds of things
like:
this.actionout.bind(this).delay(0.1);
this.actionout.delay(0.1).bind(this);
but just nothing works and I don't really see a way around this as as
soon as the brackets get involved thats a function call and I don't
want the function to be run until both the bind and the delay have
been added.
Any ideas? Surely this must be a problem that comes up a fair bit...?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---