Detecting mouse actions with JavaScript

Discussion in 'JavaScript' started by tin2mon, Sep 17, 2010.

  1. #1
    Hi.

    I'm working on the following thing...

    When a person enters a site and the mouse is not moved for 3 seconds, then an action is triggered (a popup, redirection, whatever).

    How can I count these 3 seconds in which the mouse is not moved?

    If the mouse is moved again before the 3 seconds, the countdown should automatically refresh itself and start again when the mouse cursor halts.

    Thanks,
    Tintu
     
    tin2mon, Sep 17, 2010 IP
  2. Ligra

    Ligra Member

    Messages:
    125
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #2
    Check out this guide, there is a section for the mousemove event. Maybe it could help you a bit.
     
    Ligra, Sep 17, 2010 IP
  3. dreamconception

    dreamconception Peon

    Messages:
    55
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You will need to activate a timeout action. And you need to learn how to use it and how you can clear that action again. Google it, there is a lot of information on javascript timeout.
     
    dreamconception, Sep 18, 2010 IP