+ 21
How to stop a function from other function
Like I have this code function drag(){ $('.e').draggable() } How do I stop this function from another function.
20 odpowiedzi
+ 12
You could execute the code only if a variable is true. And set the variable to false to stop the function.
https://code.sololearn.com/W3X87tc5aTbD/?ref=app
+ 8
F3tcher yes
+ 7
Infinite it is working on normal event listeners but not in draggable
+ 6
Are u using jquery ui?
+ 6
https://stackoverflow.com/questions/27656173/stop-function-from-another-function-in-jquery
Check, I think this should help you out sis
+ 5
Big Secret after drag u want to drop somewhere on page ???... What u actually want to do ?...
+ 5
F3tcher now the element id draggable and dropable . I want that when a button is clicked , the object loses its draggability
+ 5
Arnesh its not working in my code bro. Tke the same example of draggable and then check
+ 5
Infinite i tried it i didn't worked
+ 4
Big Secret i hope you are able to use this code to manipulate it.
https://code.sololearn.com/WDkKrPQO688L/?ref=app
+ 4
Big Secret i haven't actually used draggable, but i would inbox you if i'm able to
+ 4
Big Secret, check this out, it works. With drag and drop.
https://code.sololearn.com/WDUCEvb59QV4/#html
For drag and drop, you need to set draggable to false or it will seem as if it is draggable
+ 4
Arnesh No its not working its not even dragging that box
+ 4
Arnesh Thankyou
+ 3
Big Secret i think you should use a clearInterval on your code(I.e you should clear the interval when a button is clicked)
+ 3
Big Secret i will try work on an example to show you. But i may not use draggable, maybe other event handles(click, etc). hope that's okay
+ 3
Big Secret sorry i wasn't able to solve it using dragganble. Really don't know much about draggable
+ 3
Well, if you aren't using drag and drop API, and moving around the div with touchmove/mousemove...
https://code.sololearn.com/W6NX8hAV5Zp3/?ref=app
+ 2
It works(drag and drop doesn't work on the phone)🙄