Hi,
If what I want from the on_mouse_move function is, trigger another
function in two case:
1. when the mouse holds at same position for 1 second;
2. when the mouse fully stop;
in other cases (when mouse keeps moving) don't trigger that function.
Can any one tell how to implement this?
--
Thanks
John 5 1521
john_woo wrote on 29 dec 2007 in comp.lang.javascript :
Hi,
If what I want from the on_mouse_move function is, trigger another
function in two case:
1. when the mouse holds at same position for 1 second;
With each mousmove detected start a setTimeout delay of 1 sec, after
resetting the last one.
If the delay fully times out, start your function.
2. when the mouse fully stop[s?];
What is that, you will have to define that, no trigger for how long,
three days perhaps?
It is the same as above.
in other cases (when mouse keeps moving) don't trigger that function.
Can any one tell how to implement this?
Yes, it is elementary.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
On Dec 29, 1:41 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
john_woo wrote on 29 dec 2007 in comp.lang.javascript:
Hi,
If what I want from the on_mouse_move function is, trigger another
function in two case:
1. when the mouse holds at same position for 1 second;
With each mousmove detected start a setTimeout delay of 1 sec, after
resetting the last one.
If the delay fully times out, start your function.
you won't be able to tell during that 1 second, whether the mouse
stays in same position (namely X/Y never changed, the case that mouse
moves away and move back doesn't count);
The question is clear that triggering another function only when the
mouse stays for 1 second.
john_woo wrote on 30 dec 2007 in comp.lang.javascript :
On Dec 29, 1:41 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
>john_woo wrote on 29 dec 2007 in comp.lang.javascript:
Hi,
If what I want from the on_mouse_move function is, trigger another
function in two case:
1. when the mouse holds at same position for 1 second;
With each mousemove detected start a setTimeout delay of 1 sec, after resetting the last one.
If the delay fully times out, start your function.
you won't be able to tell during that 1 second, whether the mouse
stays in same position (namely X/Y never changed, the case that mouse
moves away and move back doesn't count);
Wrong, the mouse has moved if an onmousemove event was triggered.
Testing where the mouse is in x/y is not necessary nor usefull.
<http://www.w3schools.com/jsref/jsref_onmousemove.asp>
The question is clear that triggering another function only when the
mouse stays for 1 second.
Indeed.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
On Dec 30, 11:37 am, "Evertjan." <exjxw.hannivo...@interxnl.net>
wrote:
john_woo wrote on 30 dec 2007 in comp.lang.javascript:
On Dec 29, 1:41 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
john_woo wrote on 29 dec 2007 in comp.lang.javascript:
Hi,
If what I want from the on_mouse_move function is, trigger another
function in two case:
1. when the mouse holds at same position for 1 second;
With each mousemove detected start a setTimeout delay of 1 sec, after
resetting the last one.
If the delay fully times out, start your function.
you won't be able to tell during that 1 second, whether the mouse
stays in same position (namely X/Y never changed, the case that mouse
moves away and move back doesn't count);
Wrong, the mouse has moved if an onmousemove event was triggered.
Testing where the mouse is in x/y is not necessary nor usefull.
<http://www.w3schools.com/jsref/jsref_onmousemove.asp>
The question is not about the on_mouse_move definition. say mouse
moves from
A -B (move slowly) -C (here stop for 1 second then continue to
move) -D, and fully stops at D
thus the movement triggers event at A, B and C. my question was, I
wanted to trigger another function only when the mouse at C, not at B
nor D;
the setTimeout is used to delay action, regardless of whether mouse
stop 1 second then move again or keep moving without stop.
John
john_woo wrote on 30 dec 2007 in comp.lang.javascript :
On Dec 30, 11:37 am, "Evertjan." <exjxw.hannivo...@interxnl.net>
wrote:
>john_woo wrote on 30 dec 2007 in comp.lang.javascript:
On Dec 29, 1:41 pm, "Evertjan." <exjxw.hannivo...@interxnl.net>
wrote: john_woo wrote on 29 dec 2007 in comp.lang.javascript:
Hi,
If what I want from the on_mouse_move function is, trigger
another function in two case:
1. when the mouse holds at same position for 1 second;
>With each mousemove detected start a setTimeout delay of 1 sec, after resetting the last one.
>If the delay fully times out, start your function.
you won't be able to tell during that 1 second, whether the mouse
stays in same position (namely X/Y never changed, the case that
mouse moves away and move back doesn't count);
Wrong, the mouse has moved if an onmousemove event was triggered. Testing where the mouse is in x/y is not necessary nor usefull.
<http://www.w3schools.com/jsref/jsref_onmousemove.asp>
The question is not about the on_mouse_move definition. say mouse
moves from
A -B (move slowly) -C (here stop for 1 second then continue to
move) -D, and fully stops at D
thus the movement triggers event at A, B and C. my question was, I
wanted to trigger another function only when the mouse at C, not at B
nor D;
No that was not the Q.
The Q was:
1. when the mouse holds at same position for 1 second;
the setTimeout is used to delay action, regardless of whether mouse
stop 1 second then move again or keep moving without stop.
No, you are looking at my programming advice the wrong way.
I'll refrase:
Every time the mouse moves, the setTimeout is reset and restarted.
Only if there is no movement for one second, setTimeout times out and
your function is executed.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Markus Dehmann |
last post by:
I guess this is a kind of newbie question (since most pointer questions are
newbie questions).
In the program below, modify(string* s) is supposed to change the content
that s points to. But the...
|
by: Sandra-24 |
last post by:
Is there a way in python to add the items of a dictionary to the local
function scope? i.e. var_foo = dict. I don't know how many
items are in this dictionary, or what they are until runtime.
...
|
by: niels.froehling |
last post by:
Hy;
I'm stucked in modifying events to make a multi-select select-input
being additive/subtractive only. Because I should offer a solution
similar to that select for DAUs (aka. MostIdioticUser)...
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - How do I modify the current page in a browser?...
|
by: Kiran |
last post by:
Hi all,
What I am trying to do is to pass a pointer to the first element of
an array to a function, modify it in that function, and then print out
the values of the array (which has been modified...
|
by: kidders |
last post by:
Below is a script i need to modify to work and its driving me nuts.
Essentially it fades the content of an array. The original script
specified the object name, I tried to modify it to allow an...
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - How do I modify the current page in a browser?...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |