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 9069507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:26:48+00:00 2026-06-16T17:26:48+00:00

Weird one here. Earlier I was messing around with preventing the default touchmove behavior

  • 0

Weird one here. Earlier I was messing around with preventing the default touchmove behavior in an iOS webapp I’m building. It’s easy enough to add the event listener and prevent propogation, but I need to add the default behavior back to one of it’s children. As I understand it though, because the parent is disabled the child will never register the event.

So I need a solution.

Essentially, there’s a lot of swiping going on, so the default body-scrolling behavior needs to be knocked out. The page sliding around while swiping is infuriating. Naturally, I have to add the event listener to the outside container. Can’t avoid it.

How can I add back the default, browser controlled behavior to one of the children? I don’t want to fake it with my own physics and all.

Thanks for your help.

HTML:

<div id="mainPanel"> <!-- add event listener and preventDefault(); -->
    <div id="nonScrollingPanel></div>
    <div id="scrollingPanel></div> <!-- add event listener and re-enable default -->
</div>

JavaScript:

$bod.on('touchmove', '#mainPanel', function(event){

    event.preventDefault();
});

$('#mainPanel').on('touchmove', '#scrollingPanel', function(){

    return true;
});
  • 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-16T17:26:49+00:00Added an answer on June 16, 2026 at 5:26 pm

    The reason why this doesn’t work as you expect, is that jQuery runs all event handlers, unless you stop propagation in one of them. In your example, both event handlers will run.

    Here’s one solution, which I don’t like because you might actually want the event to propagate for some other purpose.

    $('#main-panel').on('touchmove', function(e) {
        e.preventDefault();
    });
    
    $('#scrolling-panel').on('touchmove', function(e) {
        e.stopPropagation();
    });​
    

    So here’s what I would do, unless iOS has some special meta tag to disable page sliding:

    $('#main-panel').on('touchmove', function(e) {
        if (!$('#scrolling-panel')[0].contains(e.target)) {
            e.preventDefault();
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a weird one, but hopefully someone can give me an idea here.
Weird to describe but here goes. I have a table with several rows. One
So I just saw a weird behavior In one script there is something like:
So here's a weird one. I've been doing a combination of interface builder and
Okay, here's a weird one that I'm having problems with (compiled with gcc btw)
Alright, so here is a really weird one. I am reading raw data into
here's a weird one: I have a PHP-CLI script that runs just fine when
Got a weird one here. Site is deployed into production and trying to bring
I have a weird one here! I have a database table that has publication
Kind of a weird one here: I have a Zend Framework setup in 1.12.

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.