Applying onscroll to an <input> tag in FF

B

bizt

Hi,

I have a site that Im working on where we have an input tag which has
a numeric value. Say that value is 1, I want to apply an event handler
where if the mouse scroll wheel is scrolled up it will go 2. If they
do a long scroll it will go 2,3,4,5,6,7,8... Obviously this involved
me capturing the event and direction.

In IE, we use something like:

<input onmousewheel="doInputScroll(event, this);"...

... allows me to capture the event but onmousewheel is only supported
by IE. In Firefox I found onscroll as well as some functions on how to
capture the direction but event handler can only be applied to certain
HTML elements however the only element I had any luck with was <body>.
I did consider wrapping my input element in a <div> and applying the
event handler to that but it didn't seem to work either for some
reason anyway.

Does anyone have any ideas how I might get this working? Its not
common functionality I know but many of our web users are used to this
feature in IE and it would be great to put this over to FF too

Cheers
Burnsy
 
A

abozhilov

Hi,

I have a site that Im working on where we have an input tag which has
a numeric value. Say that value is 1, I want to apply an event handler
where if the mouse scroll wheel is scrolled up it will go 2. If they
do a long scroll it will go 2,3,4,5,6,7,8... Obviously this involved
me capturing the event and direction.

In IE, we use something like:

<input onmousewheel="doInputScroll(event, this);"...

.. allows me to capture the event but onmousewheel is only supported
by IE. In Firefox I found onscroll as well as some functions on how to
capture the direction but event handler can only be applied to certain
HTML elements however the only element I had any luck with was <body>.
I did consider wrapping my input element in a <div> and applying the
event handler to that but it didn't seem to work either for some
reason anyway.

Does anyone have any ideas how I might get this working? Its not
common functionality I know but many of our web users are used to this
feature in IE and it would be great to put this over to FF too

Cheers
Burnsy


Actually mousewheel not only supported from IE. Chrome and Opera too
dispatched.
In FF you have DOMMouseScroll.
https://developer.mozilla.org/en/Gecko-Specific_DOM_Events#section_8
 
S

SAM

Le 9/2/09 4:35 PM, bizt a écrit :
Hi,

I have a site that Im working on where we have an input tag which has
a numeric value. Say that value is 1, I want to apply an event handler
where if the mouse scroll wheel is scrolled up it will go 2. If they
do a long scroll it will go 2,3,4,5,6,7,8... Obviously this involved
me capturing the event and direction.

In IE, we use something like:

<input onmousewheel="doInputScroll(event, this);"...

.. allows me to capture the event but onmousewheel is only supported
by IE. In Firefox I found onscroll as well as some functions on how to

capture the direction but event handler can only be applied to certain
HTML elements however the only element I had any luck with was <body>.
I did consider wrapping my input element in a <div> and applying the
event handler to that but it didn't seem to work either for some
reason anyway.

seems you need to use :
- an addEventListener catching the target scrolled
- and the DOMMouseScroll (insteed of mouseWheeel)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top