0
How to make One Click execute first function and second click execute second function ? ||
Example : I have Power mobile button,,, When we click power button display black screen (" Mean display off ") And Then when we click again power button ,, "display on" 🤔🤔🤔 how can we write this code ?
6 Respostas
+ 3
https://code.sololearn.com/WkdCAD8TbLcD/?ref=app
basic switch handler factory...
should handle correctly any number of functions, for any target (onevent attributes, 'event' addEventListener, anything else...)
callback functions are filtered (non function arguments are skipped).
+ 1
Use an if statement.
if (screen_is_on) {
... code to turn off screen
} else {
... code to turn on screen
}
+ 1
That was just a generic example. For your if condition check the state of something and write the rest of your code accordingly. You can also use a variable such as a boolean that you change the value of within the if statement each time the event happens.
If you want more help you have to be specific and share your code in the playground and explain what exactly it is you're trying to do.
0
screen_is_on
What i write ?
0
As i use display : non/block
0
visph its working,,
But out of mine understand 😅!