Divs sliding out of alignment

I am experiencing an issue with the scrolling behavior of a wrapper div that contains two nested divs. Specifically, when I scroll the wrapper horizontally on Android devices, the header section and content section seem to be out of sync and there is a noticeable delay before they catch up.

The wrapper has the default CSS rule overflow-x: auto; applied to it, and both nested elements are absolutely positioned with their left and right properties set to 0, along with other styling attributes such as heights.

I would greatly appreciate any assistance or guidance in resolving this problem. Thank you.

Below is the snippet of code that I am currently working with:

var divEditWrapper = document.createElement("div");
divEditWrapper.id = "divEditWrapper";
divEditWrapper.style.cssText = "bottom: 0px; left: 0px; overflow: hidden; overflow-x: auto;  position: absolute; right: 0px; top: 64px;";
divEdit.appendChild(divEditWrapper);

divDataHeaders = document.createElement("div");
divDataHeaders.style.cssText = "color: rgba(0,0,0,0.54); height: 54px; left: 0px; position: absolute; right: 0px; top: 0px; ";
divEditWrapper.appendChild(divDataHeaders);

divEditContent = document.createElement("div");
divEditContent.id = "divDataGridEditContent";
divEditContent.style.cssText = "bottom: 0px; overflow: hidden; overflow-y:auto; left: 0px; position: absolute; right: 0px; top: 54px;";
divEditWrapper.appendChild(divEditContent);

Answer №1

To resolve a comparable problem previously, I adjusted the styling of the div (wherever appropriate) using .div{top:0; left:0; }. You could attempt applying this style to the header div in your situation. This approach might prove effective. Best regards,

Answer №2

Upon encountering a similar problem in a different project, I revisited this issue and found that the previously successful solution did not work there. By utilizing the CSS properties -webkit-transform: translateZ(0); and webkit-backface-visibility: hidden; on the wrapper element, the problem was finally resolved.

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

Unable to launch webpack due to webpack not being detected

When attempting to start webpack, I entered the following command: npm run dev This was done in the command shell where my project and node_modules are located. Upon running the command, an error appeared in the terminal: > clear; npm run --silent so ...

Utilizing JavaScript event handlers on dynamically appended elements after the document has finished loading

One issue I am facing is with a javasript function that needs to change the value of an element appended after the document has loaded. The problem arises when trying to intercept actions on a newly appended DIV, such as: <div class="new-div"></d ...

Issues with AngularJS Directives not functioning properly when elements are added dynamically through an AJAX request

I am facing a scenario where I have a page featuring a modal window that is created using the AngularUI Bootstrap modal directive. The DOM structure for this modal is being dynamically loaded from the server, and it is triggered to open when a specific but ...

Encountering a parsing failure in the _app.js file of a new Next.js project: Unexpected token

When starting a new Next.js project, I use the following command: npx create-next-app After moving into the project folder and running npm run dev, I encounter the following error: C:/Users/mikke/Documents/Projects/next-project/pages/_app.js 4:9 Module pa ...

Deploying NextJs application with Firebase's static site generation (SS

TL;DR The new data I add to my project is not displaying on the site, even though it's in the database. The issue arises after deploying with Firebase. I created a meetup website using Firebase as the backend. Everything works fine in development mo ...

What is the best way to close an ajax page within the main page using a button?

I am dealing with a situation where I have 2 pages. The first page contains a div called 'ajaxicall', which loads another page inside it. The challenge I am facing is figuring out how to close the second page when I click on the "close" button w ...

Customizing HTML Select Elements

Can the HTML Select attribute be customized to have a flatter appearance? Although I can set the border to be 1px solid, the dropdown part still appears 3D and unattractive. ...

Using HTML to design interactive buttons that can send API requests and display their current status

Seeking assistance with creating buttons to control a remote light's ON and OFF states while reflecting their status as well. The specific http API calls for the light are necessary to toggle its state. Turn On = http://192.168.102.22:3480/data_requ ...

Is there a way to identify and retrieve both the initial and final elements in React?

Having an issue with logging in and need to retrieve the first and last element: Below is my array of objects: 0: pointAmountMax: 99999 pointAmountMin: 1075 rateCode: ['INAINOW'] roomPoolCode: "ZZAO" [[Prototype]]: Object 1: pointAmoun ...

What are the best ways to personalize my code using Angular Devextreme?

Our development team is currently utilizing Angular for the front-end framework and ASP.net for the back-end framework. They are also incorporating Devextreme and Devexpress as libraries, or similar tools. However, there seems to be difficulty in implement ...

What are some alternative ways to begin a photo album besides always using the first image

I have a gallery with 5 thumbnail images previewed, but there are more photos in the gallery. Instead of cluttering my code and hiding them with CSS, I am seeking an alternative solution. Below is my current HTML code: <div id="start_slides2"> ...

having trouble transferring data from one angular component to another

I've been attempting to send data from one component to another using the service file method. I've created two components - a login component and a home component. The goal is to pass data from the login component to the home component. In the l ...

Move to the following array when clicking PHP (using Ajax, perhaps?)

How can I trigger php code when a button is clicked? (I understand the distinction between client-side and server-side. However, I believe I have encountered a similar scenario before.) Consider the following array : $test_id = [ 1 => '15 ...

Issue with dynamically adjusting flex box width using JavaScript

Currently, I am developing a user interface that heavily relies on flexbox. The layout consists of a content area and a sidebar that can be toggled by adding or removing a specific class. Whenever the sidebar is toggled, the content area needs to be manua ...

Arrange jQuery UI elements in descending order

I need to rearrange a list in descending order, starting from the highest value down to the lowest. The values are currently listed as 10,9,8,7,6,5,4,3,2,1 and I need to update the data-ids accordingly. jQuery('.photos').sortable({ stop: f ...

Encounter a snag when attempting to upgrade to React version 16.10.2 while working with Ant Design Components - the error message reads: "

After upgrading to the latest React version 16.10.2, I encountered issues while using Ant Design Components. I specifically wanted to utilize the Title component from Typography. Here is an example of what I was trying to do: import { Typography } from & ...

Performing a JavaScript/jQuery callback to server without the need for an accompanying executable backend

Today, a colleague in the tech world posed an interesting question to me: Can jQuery (or JavaScript in general) retrieve information about the filesystem from its source without the need for executable code? Initially, I instinctively responded by saying t ...

Identify the page search function to reveal hidden content in a collapsible section

Our team has implemented an expandable box feature on our wiki (in Confluence) to condense information, using the standard display:none/block method. However, I am looking for a way to make this work seamlessly with the browser's find functionality. S ...

How to use Laravel to show a graph sourced from a separate database connection

Is it possible to create a pie or doughnut chart in Laravel using data from a separate database connection ('mysql2' in the .env file)? I have successfully generated charts from the main database, but this time I didn't migrate the second da ...

Is `h` equal to `createVNode` function?

Both h and createVNode are exposed from vue. The documentation on this page seems to imply that they are interchangeable: The h() function is a utility to create VNodes. It could perhaps more accurately be named createVNode(). However, replacing h with ...