I have this code. I added mouse events for the left and right buttons but I also need to add touch events. I am stuck at that. | Sololearn: Learn to code for FREE!

+15

I have this code. I added mouse events for the left and right buttons but I also need to add touch events. I am stuck at that.

I am stuck at the touch events. I tried a few ways and every time something was wrong because the movement of the circle was either accelerating, meaning that the clearInterval did not work properly or the whole circle stood in the same position, without any rotation. Help me please, I am stuck. I am thinking that in the worst case scenario, this will be a code only for users with mouse. Extra info: when not pressing the buttons, the circle should rotate slowly, and then stop when we press any of the 2 buttons. Pressing any of the 2 buttons will cause a quicker rotation speed and releasing them will stop the quick rotation and set the interval again with the slow rotation. I completely deleted my attempts on touch events, so that I or anyone can start with those from 0. The codepen link to the code. The obe i posted may not work properly https://codepen.io/AlexTAG/pen/qBRpQoL //Ik it the code is full of intervals and it looks like hell.

4/13/2021 9:44:29 AM

🍇 Alex Tușinean 💜

8 Answers

New Answer

+17

Here is a solution for that does it fullfil your need 🍇 Alex Tușinean 💜 https://code.sololearn.com/Wym7316GL4sG/?ref=app

+6

Woah, it looks so simple. To think it was just a matter of true or false, amazing! Thanks a lot.

+3

Welcome 🍇 Alex Tușinean 💜

+3

Arnav Kumar [📕Schools📚] Thanks for your help to a college student. You deserve a compliment as others do who are helping. This is the thru spirit of SoloLearn. I'm very happy and excited to see that the next generation is doing what we old geezers did at a time that no one knew very much and experimenting was the only solution. Even a time with so much and fast changes that you couldn't keep up. What you learned today was obsolete the next week. Anyway I wish you all a lot of success and fun because coding is fun too in my point of view. I'm retired but keep myself busy with coding so keep up with the spirit my friends 😉

+2

🇺🇸 Anatoli🇧🇪🇪🇺 Thanks 🥰 Even in today's date there are many topics in coding what are not talked about much and have very less resources and when you search you don't find a relevant explanation and we have to do it by experimenting by ourselves As Humans we are always curious to learn and help others as we are in community So experimeng will never get old 😉 And I will try best in my life to learn and become a successful with just a thought in my mind "Success doesn't matters what matters is your journey to achieve the success" so i enjoy the journey 😃

0

This is so complicated that it makes my head spin Did you make it in Dreamweaver? Maybe a Notepad++? I admire you so much

-4

Привет

-6