javascript wait for click | Sololearn: Learn to code for FREE!

+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 .

2/13/2019 9:14:26 AM

ABDELMOUGHIT GARDAM

11 Answers

New Answer

+6

You can set the visibility of the body to "hidden" until you click the screen , and then everything will appear.

+3

add a full screen layer on your code Will continue work until onclick is detected

+3

You should have a toggle var. Let's say var x = 0; onclick->x=(1-x); Then use if-else

+2

i want to stop execution of the code until onclick is detected

+2

@jaydeep khatri i want to stop the execution of the code with ondblclick and run it back when onclick is detected

+2

I could need a little bit more input on what your code exactly does. Makes it easier to understand.

+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

+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

+1

I do have a toggle variable and conditionals. But I'm not sure about the rest of the code. var TOGGLE

+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 ??

+1

@pete wright when it's dblclick the code is paused but when i dblclick to resume it move away