|
-
Mar 15th, 2005, 06:49 AM
#1
Thread Starter
Frenzied Member
Track Mouseover Movements *RESOLVED*
I have written a scrolling panel consisting of one main div and as many internal divs as required (these move within the main div to achieve the scrolling). I have two JavaScript methods that scroll the panel in opposite directions - scrollLeft() and scrollRight().
I would like to be able to know when a user moves the mouse pointer over the main div and then track if they move the mouse left or right and scroll in that direction accordingly. It's kind of like a drag scroll without the need to click the mouse button (as all the items within the scrolling panel will link off somewhere).
If anyone can point me in the right direction I would appreciate it.
DJ
Last edited by dj4uk; Mar 18th, 2005 at 12:26 PM.
-
Mar 18th, 2005, 10:35 AM
#2
Re: Track Mouseover Movements
Put two additional div on top of the main div(transparent), the size of the each div will be half of the main div, now track which div the mouse is over. if the pointer is on top of the left div then call scrollLeft if the mouse is over the right div then call scrollRight. Simple but should work nicely.
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Mar 18th, 2005, 12:26 PM
#3
Thread Starter
Frenzied Member
Re: Track Mouseover Movements
Thanks for the reply - yes I think that would work equally well.
I have used the following solution though:
Code:
function cursorPosition(e)
{
newPosition = e.clientX;
if (newPosition < lastPosition) {
scrollLeft();
} else if (newPosition > lastPosition) {
scrollRight();
}
lastPosition = newPosition;
}
Where the onmousemove event of the main div calls cursorPosition.
Thanks anyway!
DJ
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|