I'm just learning the JavaScript touch event. For this I created this example:

Example on Codepen

In the above example, you can grab the element and move it to the right or left.

It works. However I want to limit the horizontal movement of the element (for example only 100px to the left and 100px to the right).

How can I do this?