If a user touches outside of the scroll component on mobile, the scroll in the popup freezes

I have a webpage that includes two scrollable lists: one in the main body and another in a popup window. To prevent scrolling of the main body when the user scrolls inside the popup, I am using a standard solution recommended in this Stack Overflow post about preventing BODY from scrolling when a modal is opened.

However, I've encountered an issue with this solution on mobile devices, specifically when testing it on an iPhone 6 using Safari.

The problem is that touching outside the popup area causes a delay or freeze in scrolling the list within the popup for a few seconds. It seems like the scroll functionality inside the popup becomes temporarily unavailable or unresponsive.

The code snippet used on the page is as follows:

<!DOCTYPE html>
<html lang="en">
...
...

// JavaScript functions

function showPopup() {
    // Functionality to toggle visibility of popup container
}

$(document).ready(function () {
    // Initialization function upon document load
});
</script>

</body>
</html>

You can view a live demo of this code on CodePen here: http://codepen.io/annmirosh/pen/MJeaqO.

For a working example, visit:

If anyone has any suggestions or solutions to address the scroll freezing issue, your input would be greatly appreciated!

Thank you!

Answer №1

If your website is not responsive and requires scrolling left and right, an issue may arise. This occurs when the web page has a bottom scroll bar.

However, if the HTML section's body has overflow:hidden in the CSS, it will prevent scrolling. Unfortunately, the link

http://codepen.io/annmirosh/debug/MJeaqO
seems to be inactive.

In addition, I have noticed that my own website's modal popup also contains a scroll bar on the right side, which does not interfere with other content.

If a user touches outside of the popup area, they should not be able to scroll if the body has overflow hidden and the popup layer is positioned absolutely or fixed with a higher z-index property.

A suitable solution can be found here:

http://stackoverflow.com/questions/9538868/prevent-body-from-scrolling-when-a-modal-is-opened

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Relocating to reveal or conceal item

I am currently working with jQuery and trying to achieve a specific functionality. My goal is to hide and unhide an element, while also focusing on the exposed area once it becomes visible. I have a link #welcomeselect that, when clicked, should reveal t ...

What is the method for creating two separate columns that can scroll independently?

I am faced with a challenge involving a modal that contains two columns. My goal is to make these columns scrollable independently of each other while ensuring the scrollbar remains hidden. Thus far, I have managed to make the row scrollable with a hidden ...

Pause the ajax response using jQuery

I encountered a simple issue that is causing me trouble. It seems that when I send an ajax request, there isn't enough time to assign the value to the combonews variable: jQuery.ajax({ type: "POST", url: "People.aspx/LoadCombo ...

"Concealing specific routes in Vue Router depending on a certain condition - what's the

I need to determine which routes to hide based on a condition that evaluates to true or false. I have a collection of routes, such as: - Products - Clients For instance, if a user logs in but does not have the permission to edit products, then the updated ...

The container's height is determined by the CSS top position of the last child element within the container, with a

I'm attempting to adjust the height of a container based on the position of its last child using Isotope, infinite scroll, and Packery. Below is a snippet of the code: <html> <div id="container" class="variable-sizes isotope" style="p ...

Each time the page is refreshed, the most recent form data submitted is continually appended to an array

I have implemented a post request to add input data from a form. The entered data is stored in an array variable burg and then displayed on my index.handlebars view. Everything works as intended, but when the page is refreshed without any input in the form ...

What could be the reason behind PHP not picking up my AJAX request string?

I'm encountering an issue where PHP is not recognizing my request string as defined. When I include $_GET['ask'] in my PHP file, it triggers the error message - Notice: Undefined index: ask. Interestingly, when I manually input the query in ...

I am facing an issue with the clearTimeout function in my JavaScript code. Can anyone help

I am encountering some issues with the clearTimeout() function. The setTimeout() function is working as expected, but I want it to stop running when I close my notification. I'm not sure what is causing the problem in my function. After closing the ...

Retrieving the value of a formControl within a formArray is made possible through a reactive form in

How can I retrieve the value of ItemName in my HTML code? When I attempt to use {{invoiceForm.controls[i].items.controls.itemName.value | json}}, it returns as undefined. <form [formGroup]="invoiceForm"> <div formArrayName="items" *ngFor="let ...

Artwork expanding incorrectly on HTML canvas

I'm encountering an issue while attempting to draw on an HTML canvas. I've specified 50 circles and multiple lines within a canvas of size 1000x1000 px, but not all circles are appearing as expected. My assumption is that the elements are being ...

What is preventing the question div and buttons from expanding according to their content?

After experimenting with setting the height of the question div to auto, I found that it would stretch to fit its content. However, I am looking for a solution without overflow: auto or scroll. Is there a limit to how responsive it can be once a certain ...

Mysterious JQuery attribute

I've come across a piece of code that utilizes an unfamiliar selector that I can't seem to figure out: $("div[tag=" + someVariable + "]").css("display", "block"); From what I gather, the selector is searching for a div element with an attribute ...

Creating an overlay-section in three.js with orbit-controls that dynamically responds to the main view's movement

I'm looking to incorporate a section in the corner of my main view that displays a miniature version of the main view. Currently, I am developing a webpage using JavaScript with three.js. The main view window showcases various geometries that can be ...

Unable to display an image prior to its upload

I'm facing an issue with changing the image for my second data. It's not updating, but when I try it with the first data, it works fine. I'm unsure why this is happening and would appreciate any help in resolving it. Here is the form where ...

Caution: session_start(): Unable to initialize session cookie - headers have already been sent by (output initiated at

A warning message is displayed on the login page: "It's working in localhost but not in remote host" Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at on line 8) Warning: sess ...

Arrangement of Axes in Google Graphs

I have a basic form where users can input data through drop-down selectors. There are 10 questions, each with a rating out of 10. The entered data is then used to generate a Google graph on the same page. Although the graph populates correctly, the axis ...

Preventing browser freeze by using window.addEventListener in React

I'm new to React and I'm facing an issue where the code seems to freeze the browser (I'm using Chrome) when I click multiple times on the window. Can someone help me understand why? import "./App.css"; import { useState } from &quo ...

Leverage closures within Underscore.js templates for enhanced functionality

Is there any benefit to utilizing a closure in an underscore template for purposes such as keeping track of counters? Here's a simple example: <% (function( models ){ var length = models.length-1, section = ""; _.each( models, functi ...

When clients format datetime, the default date value is sent on the form post

I'm attempting to utilize this particular example in order to correctly implement datetime formatting In my view model, I have a property for datetime public class MyViewModel { [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0 ...

Using Typeof in an IF statement is successful, but attempting to use ELSE with the same

My goal is to create a JavaScript variable called str. In case the ID idofnet doesn't exist, I would like to prompt the user for a value to assign to str. However, if idofnet does exist, then I want to retrieve its value and assign it to str. This is ...