Results 1 to 3 of 3

Thread: Track Mouseover Movements *RESOLVED*

  1. #1

    Thread Starter
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    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.

  2. #2
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    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 :

  3. #3

    Thread Starter
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    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
  •  



Click Here to Expand Forum to Full Width