+ 7

javascript wait for click

Hello everybody i want to set my code when ondblclick event is detected the program will sleep untlil i onclick is detected .

13th Feb 2019, 9:14 AM
ABDELMOUGHIT GARDAM
ABDELMOUGHIT GARDAM  - avatar
11 Answers
+ 6
You can set the visibility of the body to "hidden" until you click the screen , and then everything will appear.
13th Feb 2019, 9:42 AM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 3
add a full screen layer on your code Will continue work until onclick is detected
13th Feb 2019, 9:49 AM
Jaydeep Khatri
Jaydeep Khatri - avatar
+ 3
You should have a toggle var. Let's say var x = 0; onclick->x=(1-x); Then use if-else
14th Feb 2019, 11:28 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
i want to stop execution of the code until onclick is detected
13th Feb 2019, 9:45 AM
ABDELMOUGHIT GARDAM
ABDELMOUGHIT GARDAM  - avatar
+ 2
@jaydeep khatri i want to stop the execution of the code with ondblclick and run it back when onclick is detected
13th Feb 2019, 10:22 AM
ABDELMOUGHIT GARDAM
ABDELMOUGHIT GARDAM  - avatar
+ 2
I could need a little bit more input on what your code exactly does. Makes it easier to understand.
14th Feb 2019, 12:04 PM
Pete Wright
Pete Wright - avatar
+ 2
EDIT: modified the script, so that it will stop / continue running, each time the user double clicks somewhere on the document body. But somehow the tables are duplicated now. I'll take a look at the code and try to figure out what is doing this, but that might take some time... EDIT 2: Take a look at function loader4(). I have disabled it now and the duplicate cells disappeared. It would be easier, if all the text was English, so I could at least guess, what is happening. Abdo Gardam is it the one code on your SoloLearn Profile page? I cleaned up the code a little bit, moved the declared styles and inline styles to the CSS section, moved and merged all scripts to the JS section added JS function calls where necessary. Could you please try out the code now and tell me if it does what it should do? Thanks Here is the modified code: https://code.sololearn.com/WlTuPjyG1uVI/?ref=app
14th Feb 2019, 7:28 PM
Pete Wright
Pete Wright - avatar
+ 1
@pete wright this is my code i want to when dblclick is detected i want to wait for a click to run again please and thank you
14th Feb 2019, 2:08 PM
ABDELMOUGHIT GARDAM
ABDELMOUGHIT GARDAM  - avatar
+ 1
I do have a toggle variable and conditionals. But I'm not sure about the rest of the code. var TOGGLE
14th Feb 2019, 11:31 PM
Pete Wright
Pete Wright - avatar
+ 1
can i change the visibilty of a div when it's doublclick and clear id_interval and when it's onclick the toggle continue and set id_interval ??
15th Feb 2019, 8:01 AM
ABDELMOUGHIT GARDAM
ABDELMOUGHIT GARDAM  - avatar
+ 1
@pete wright when it's dblclick the code is paused but when i dblclick to resume it move away
15th Feb 2019, 8:11 AM
ABDELMOUGHIT GARDAM
ABDELMOUGHIT GARDAM  - avatar