Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 4.50 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-06-2004, 11:53 PM   PM User | #1
SlavaTT
New Coder

 
Join Date: Oct 2003
Location: Ukraine
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
SlavaTT is an unknown quantity at this point
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
SlavaTT is offline   Reply With Quote
Old 04-07-2004, 08:37 AM   PM User | #2
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
<div onmousewheel="return false">......</div>
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Old 04-07-2004, 12:45 PM   PM User | #3
SlavaTT
New Coder

 
Join Date: Oct 2003
Location: Ukraine
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
SlavaTT is an unknown quantity at this point
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
SlavaTT is offline   Reply With Quote
Old 04-08-2004, 07:51 AM   PM User | #4
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
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>
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Old 04-08-2004, 02:40 PM   PM User | #5
SlavaTT
New Coder

 
Join Date: Oct 2003
Location: Ukraine
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
SlavaTT is an unknown quantity at this point
It works.

Thank you Kor.
SlavaTT is offline   Reply With Quote
Old 04-08-2004, 05:08 PM   PM User | #6
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
Thumbs up

You're welcome... Any time here for help, if we are able to
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:29 AM.


Advertisement
Log in to turn off these ads.