Topic: catch scroll event
Hi Moro,
How can I catch the onscroll event ?
My real problem is the following:
I have an input that, when the user sets focus on it, I open a pop-up with a Mif.Tree in it.
The user can then select an item in the tree and it will fill in the input with the corresponding item path. The thing is, on the blur event of the input, I hide this pop-up. In order to prevent the Mif.Tree pop-up from disappearing when the user clicks on an item, I set a timer on the blur of the input as follows:
--------8<---------------------------
/*...*/
'focus': function(){
$clear(blur_timer);
dirSelector.setInput(this);
dirSelector.show();
}
'blur': function(){
blur_timer = function() {
dirSelector.hide();
}.delay(200, this);
}
/*...*/
--------8<---------------------------
And my class that derives from Mif.Tree, I do the following:
--------8<---------------------------
var DirectorySelector = new Class({
Extends: Mif.Tree,
/*...*/
setInput: function(input){
this.options.input = $(input);
},
show: function(){
this.options.container.setStyle('height', '0');
this.updatePosition();
new Fx.Tween(this.options.container).start('height', 0, 200);
},
hide: function(){
this.options.container.setStyles({'top': '-1000px', 'height': '0'});
},
toggleClick: function(event){
// Force focus to input
this.options.input.blur();
(function() {this.options.input.focus();}).delay(1, this);
this.parent(event);
}
});
--------8<---------------------------
As you can see, clicking an item of the tree sets the focus back to the input. This works fine with all browsers except with IE when I try to scroll, the input loses focus and so the pop-up disappears.
This is why I ask: who can I catch the onscroll event in order to force focus back to the input ?
Thank you for your time.
Cheers,
Peter