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

Utilizing jQuery's multiple pseudo selectors with the descendant combinator to target specific elements

My code includes the following: <div class="a"><img></div> and <div class="b"><img></div> I want to dynamically enclose img tags with a div and utilize $(":not('.a, .b) > img") for ...

Tips on how to ensure the navigation menu is the same size as its child elements in the navigation menu

I'm currently designing a navigation menu that includes a child navigation menu. My goal is to have the size of the main navigation menu match that of the child navigation menu. To achieve this, I've created three hyperlink tags followed by a di ...

(discovered: [object Promise]) utilizing Material UI and DexieJS

Exploring DexieJS and Material UI for the first time has been quite a learning experience, so I may have overlooked a crucial aspect. Here is a glimpse of my code: Subscreen.tsx const [fightersArray, setFightersArray] = useState<FighterEntity[]>([]) ...

Obtaining images from the internet using JSON in Android

Attempting to gather news information from the web has been relatively easy so far, as I am able to retrieve the header and subject of the news. However, I have encountered a challenge regarding how to extract images from JSON data. Below is the snippet o ...

Show and Arrange Various Key-Object Data pairs

I'm facing a challenge with mapping and displaying a JSON file in a different structure. I need help figuring out how to map the data properly. Here's the JSON file: var data = { "megamenu": [ { "name": "level1.2", "link": "#", ...

Strengthening the core: Preserving a full set of data on a server that doesn't

After going through various discussions on how to save a Backbone collection using a non-RESTful server, I am still a bit puzzled. I have set up a collection where I've customized the data for posting to my API ("/api/entity/735/request/personDelete" ...

Why does my chart.js disappear every time I perform a new render?

Hey there, I'm facing an issue with my code. Let me paste what I have... import React, { memo, useEffect } from 'react'; import Chart from "chart.js"; /* redux-hook */ import { useSelector } from 'react-redux' const lineChart = m ...

Reordering the stacking order of Grid Items in material-ui

I'm facing an issue with the stacking order of grid items when the browser shrinks. On a regular desktop screen (lg): --------------------------------------------- | col 1 | col 2 | col 3 | --------------------------------------- ...

Expressing the power of multiple nested routers

Can multiple nested routers be implemented in an Express server? Imagine running a vehicle servicing business and wanting to organize the API into different services, each with its own set of actions: app.use('/clean', cleanRoutes); app.use(&apo ...

Display the background image beyond the boundaries of the div element

I am facing an issue with an image background on a website. The background consists of leaves spreading out to the middle of the page, creating a height of 600px. However, I need to divide this image into three sections: header, content, and footer. Curren ...

Incorporate JQuery into your NodeJS project by leveraging the existing minified file

Can we integrate JQuery into Node.js and make JQuery AJAX calls without altering the syntax by using a pre-downloaded minimized JQuery file? To clarify, I have the minified file and wish to incorporate it into Node.js in this manner: var jquery = require( ...

Experiencing issues with regex in JavaScript: all text enclosed within <angular> brackets vanishes

I am trying to analyze a formula and present it on the screen. For instance, I want to be able to input <path>T Q, where <path>T remains unchanged, and Q is a variable. It accepts this input, but when displaying it on the screen, only T Q shows ...

How to perfectly position various height <a> elements in a WordPress mega menu

I'm currently working on a WordPress mega menu with four columns, each with a heading or top menu item. The headings should have a gradient border at the bottom and differ in length. However, I'm facing an issue where some headings span two lines ...

changing background color smoothly in a short time without using JQuery

Check out this link for some code .back { margin: 20px; padding: 100px; background: yellow; font-size: 30px; } <div class="back"> Fun place to stay. We got a golf cart to see the rest of the island, but the ...

Creating an image from the contents of a div is necessary in order to visually

I am looking to develop a software that can: receive text input from the user and place it in a specific div allow users to adjust font, color, and size based on their preferences enable image uploads as background save all customizations and send them v ...

Alter the row's color using the selection feature in the module

Is there a way to change the color of a row when a specific property has a certain value? I found a solution for this issue on Stack Overflow, which can be viewed here: How to color row on specific value in angular-ui-grid? Instead of changing the backgro ...

Optimize Date Formatting within a React Application Using Material UI Data Grid

I am currently working with MUI Data Grid Pro and I have an issue with filtering dates in the format dd-mm-yyyy. While the dates are displayed correctly in the columns, the filtering defaults back to mm-dd-yyyy. https://i.stack.imgur.com/Ue12K.png For mo ...

Finding the right property by comparing it with an array of objects in a MongoDB aggregation query

In my mongoDB collection, I have a field called 'abc' that contains an array of objects structured like this: 'abc': [{"_id": new ObjectId("someId"), "name": "entity name"}] I am looking to perfo ...

Using jQuery and AJAX manipulates the value of my variable

My AJAX request seems to be causing jQuery to change the variable that is passed to it. Here is the JavaScript code: <script type="text/javascript"> function ResolveName(id) { $.ajax({ url : 'resolvename.php', ...

Steps to create an if statement using jQuery

.data( "autocomplete" )._renderItem = function( ul, item ) { return $( "<li></li>" ) .data( "item.autocomplete", item ) if ( ( item.parent_term_id == "16" ) ) { .append( "<a>" + (item.child_term ? item.child ...