1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

JavaScript touch event - Limiting the amount of horizontal movement

Discussion in 'JavaScript' started by kayut, Apr 25, 2017.

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


    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?

    kayut, Apr 25, 2017 IP