![]() |
Overriding onmousewheel event
Hello
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). Thanks Vladislav |
<div onmousewheel="return false">......</div>
|
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. Slava |
If you use onmousewheel to fire another function, try:
<div onmousewheel="that_function();return false">......</div> or: function that_function(){ ... ... statments; return false } <div onmousewheel="return that_function()">......</div> |
It works.
Thank you Kor. |
You're welcome... Any time here for help, if we are able to :thumbsup:
|
| All times are GMT +1. The time now is 09:18 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.