R
rjonasz
Hey Everyone,
I'm trying to scroll a textarea to the position of the caret which is
below the visible area of the textarea in firefox. I have code which
works in IE but the code I use for firefox creates an elastic band
effect. The textarea quickly scrolls down then bounces up to the top,
no matter what I try.
Has anyone run into the same difficulty? How did you solve it?
This is the code I'm currently using:
Note: inpu = textarea
var ev = document.createEvent ('KeyEvents');
ev.initKeyEvent('keypress', true, true, window,false, false, false,
false, 0,inpu.value.charCodeAt(pos-1));
inpu.dispatchEvent(ev); // causes the scrolling
inpu.setSelectionRange(pos, pos);
Thanks for your help!
Randy
I'm trying to scroll a textarea to the position of the caret which is
below the visible area of the textarea in firefox. I have code which
works in IE but the code I use for firefox creates an elastic band
effect. The textarea quickly scrolls down then bounces up to the top,
no matter what I try.
Has anyone run into the same difficulty? How did you solve it?
This is the code I'm currently using:
Note: inpu = textarea
var ev = document.createEvent ('KeyEvents');
ev.initKeyEvent('keypress', true, true, window,false, false, false,
false, 0,inpu.value.charCodeAt(pos-1));
inpu.dispatchEvent(ev); // causes the scrolling
inpu.setSelectionRange(pos, pos);
Thanks for your help!
Randy