Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8708903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:14:34+00:00 2026-06-13T04:14:34+00:00

On my page, when you swipe right on an element, the element will move.

  • 0

On my page, when you swipe right on an element, the element will move. I have the following code to handle these swipes:

window.addEventListener("touchstart", touchStart, false);
window.addEventListener("touchmove", touchMove, false);

Problem is, it’s not just affecting the elements that I want to be swipe-able. Instead, if I swipe anywhere on the page, it will run touchMove. To fix this, I tried:

var content = document.getElementById("content");
content.addEventListener("touchstart", touchStart, false);
content.addEventListener("touchmove", touchMove, false);

This sort of worked, but when a div was shown (via user interaction) over #content, the events would still fire.

Another solution that I considered was binding these events to the elements in #content, the ones that should have swiping enabled. Problem is, these elements are added to the page dynamically, so when the function above is called on page load, the elements aren’t accounted for. I then looked to using jQuery’s .on() method, like so:

$("#content .row").on("touchmove", touchMove, false);

But that’s not calling touchMove at all.

Is there a better way to do all of this? Does it make sense that touchMove would get called on an element that’s not a child of #content when the event listener is assigned to only #content?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T04:14:35+00:00Added an answer on June 13, 2026 at 4:14 am

    Try this way by attaching event to document and providing filter for your required elements.

    $(document).on("touchmove", "#content .row", touchMove);
    

    Edit as per comments, you can get event this way

    $(document).on("touchmove", "#content .row", function(event){
           alert(event.target.id);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented horizontal page view. One base page and three swipe pages. The
My page consists of the following code: @{ var db= Database.Open(Surgestuff); var sqlQ =
I have a toggleswitch on a pivot page. When the user 'swipes' the page,
I have a page that has a listbox with the following item template as
I have a jquerymobile code for changing the pages with swipe function. My mobile.changePage
Right now my DOM has three divs with data-roll=page , all of them have
So I have an app on the main page is details of the current
I need to have a navigation menu that reflects page changes based on clicks
I have a container on a page, which has has a huge overflow-x. On
I have an UIViewController on showing my friends' data. This controller supports swipe gesture:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.