View Full Version : Overriding onmousewheel event

04-06-2004, 11:53 PM

I have a div element with it's childNodes collection filled with span elements,
div has style.overflow set to auto. I want it to work like a select/listbox.
I attached an event handler to onmousewheel event in my javascript class and scroll this div using scrollTop property when next/prev span element is not in div's visible area.
But trouble is div implements mousewheel scrolling too, like you're scrolling html page and I have some kind of a double scrolling:) . What I want is to disable div's standard mousewheel scrolling (but keep scroll bars).



04-07-2004, 08:37 AM
<div onmousewheel="return false">......</div>

04-07-2004, 12:45 PM
I need to handle onmousewheel, because I do there my own event processing - changing background on items and scrolling.
What I want is to disable div's built in scrolling behavior , I use scrollTop property myself.
For example when user rotates wheel I select (set blue background) on the next or previous span elements in div, to work like listbox/select.
But at the same time div scrolls content itself.


04-08-2004, 07:51 AM
If you use onmousewheel to fire another function, try:

<div onmousewheel="that_function();return false">......</div>


function that_function(){
... statments;
return false

<div onmousewheel="return that_function()">......</div>

04-08-2004, 02:40 PM
It works.

Thank you Kor.

04-08-2004, 05:08 PM
You're welcome... Any time here for help, if we are able to :thumbsup:

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum