Browsing using the "touchmove" feature feels extremely laggy

I implemented a workaround to achieve "position:fixed" on mobile devices, specifically my Android device. This involved creating two divs with heights that combined to match the screen height through JavaScript, and adding touch listeners to the bottom div. These events would then adjust the scrollTop value, mimicking the functionality of an old script called "touchScroll.js."

While this setup allowed for successful scrolling with a sling feel, the overall experience was quite choppy compared to the smooth scrolling behavior of the OS. In an attempt to address this issue, I tested various CSS solutions such as using "-webkit-backface-visibility:hidden;" and "-webkit-transform:translate3d(0,0,0);" on different elements like the div itself, the body, or a combination of both, but none proved effective. Instead, these tricks interfered with the keyboard appearing in input fields.

Another approach I explored was creating an internal div within the scrolling container and adjusting its position by setting it to "position:absolute" and modifying its top property instead of manipulating the scrollTop value. Unfortunately, this strategy did not eliminate the choppiness.

Given these challenges, I am seeking advice on resolving the choppy scrolling issue. Any suggestions or solutions would be greatly appreciated.
For reference, you can view an example here:

Answer №1

It seems that finding a solution for this issue may be challenging, as Android browsers are known to have subpar rendering performance. The performance and compatibility of your example may vary across different Android versions, devices, and browsers. For instance, the example runs smoothly on my Android 4.0.4 Chrome browser but fails to function properly on the factory browser.

One tip is to prioritize using CSS transformations over other properties like scrollTop, as they are often hardware accelerated. This approach is similar to how iOS Mobile Safari and modern Android browsers handle rendering tasks.

You might want to consider experimenting with the latest versions of TouchScroll or iScroll, as they leverage CSS transformations and potentially include other optimizations too.

The use of

-webkit-transform:translate3d(0,0,0);
can help enforce hardware acceleration, particularly on the element that is being manipulated (such as the content div in your case). However, newer versions of scroll libraries may override this property. Additionally, setting -webkit-backface-visibility to hidden can address flickering issues or potentially enhance performance when used alongside -webkit-transform.

Answer №2

-webkit-overflow-scrolling: touch; 

This attribute is designed to improve the smoothness of scrolling. However, its effectiveness on older Android devices is uncertain.

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

In my Next.js project, I am looking for a way to make a modal continue to stay

I am looking to implement a feature where the modal remains visible even after a website refresh. Currently, when a user logs out, the page refreshes and the modal displaying "sign-out successful" disappears. My goal is to have the modal reappear after t ...

Can you share the outcomes of executing a Node.js program in real-time?

Is there a method to execute a program (such as tcpdump) and have nodejs capture the console output in real-time to display in an HTML format without saving it? I am interested in running a program that displays information in the console, with the capabi ...

Platform Independent Data Storage Solution

Looking to create a Cross-browser compatible Web Application using HTML, JS, and CSS. In need of a robust database storage solution that can be queried on the client side using JS. While Web SQL/SQLite seems like a good option, it lacks support in IE. Does ...

Concealing Images in HTML Without Reserving Space for Them

Our task is to create a website here: I tried hiding elements using display: none; However, I ended up with a large blank space. https://i.sstatic.net/B2E8Y.jpg This is the HTML code: <h1>OUR PORTFOLIO</h1><div class="subtext-top"& ...

Joomla CSS styling malfunctioning

I've been exploring the creation of an in line menu using Joomla 1.6 and CSS. The issue arises when Joomla removes <span class="dmenu"> from the document before saving, despite having all cleanup options turned off. This led me to try a couple ...

Arrange elements in a vertical layout and align them to the left when they exceed the boundaries of their container

I am seeking a solution for laying out my design, similar to the one shown in this image Essentially, I have a container with a fixed height of 300px. I want to display a list vertically with each item taking up a width of 33%. If the list becomes too lon ...

ReactJS not displaying the class effect as intended

When using the react zoom pan pinch library, I am trying to set the height to "100%" for TransformWrapper and TransformComponent. Interestingly, it works perfectly fine when done through Chrome inspect, but when attempting to add a className or use style={ ...

implementing conditional logic in angularjs expressions

<p>{{isExisted}}</p> Looking to show either "Active" or "Inactive", but the isExisted variable only returns true or false. Need help with setting up a conditional if else statement to change it to the desired value. ...

Run an npm script located in a different package

Imagine I have two node packages, one named parent and the other named child. The child package contains a package.json file with some scripts. Is it viable to merge the scripts from child into the context of parent? For instance: child/package.json: "s ...

Adjusting the Pace of a CSS Marquee

My CSS marquee effect is working perfectly, but I am having trouble with the speed. The issue arises when the text length varies - shorter text takes longer to scroll while longer text scrolls quickly. This inconsistency is due to the animation duration an ...

Once I incorporated Bootstrap into my project, I noticed a noticeable white space between the div elements

Welcome to My Code Playground I was sailing smoothly with my project until I decided to include Bootstrap. Seems like there's something missing in the details, so here I am reaching out. If you spot the issue, please feel free to correct my code. &l ...

Conceal an element along with its space, then signal the application to show alternative content using React

Greetings everyone! I seek assistance with a React Application that I am currently developing. As a newcomer to the Javascript world, I apologize if my inquiry seems trivial. The application comprises of two main elements: a loader, implemented as a React ...

Arranging Bootstrap Cards in an Orderly Stack

I recently created a set of bootstrap cards displayed like this: <div class="card-deck"> <div class="card"> <img class="card-img-top" src=".." alt="Card image cap"> <div class="card-body"> <h5 cl ...

Guide on making a flowchart using CSS

I'm working on creating a CSS flow chart diagram and I've included an image below for reference. Might there be a straightforward method to achieve this? I've been scouring the web for examples, but I'm unsure of what terminology to use ...

Why won't the div move when I click it?

Could you please explain why my JavaScript code isn't functioning as expected? The intended behavior is for the 'mark' div to move to the current mouse coordinates upon clicking within the map. ...

Simplifying the process of implementing Jquery CSS Toggles

I am planning to simplify the process of toggling visibility for 12 different divs when clicking on 12 different buttons. Instead of repeating the same code multiple times, I am considering a more efficient approach. My idea is to: Step A) Initially hide ...

Retrieve a subsection of an object array based on a specified condition

How can I extract names from this dataset where the status is marked as completed? I have retrieved this information from an API and I need to store the names in a state specifically for those with a completed status. "data": [ { "st ...

Is it possible to include Helvetica or a similar font in my web application for shipping?

My web-app is Java/HTML based and hosted on the cloud. Users will access it using IE, Chrome or Mozilla. I would like to use Helvetica or a similar font, but they are not readily available on most systems (windows/IE/Chrome/Mozilla). Is there a way for me ...

Text will not be moved to a new line

Hello, I am encountering an issue with my messaging system where the messages retrieved from the database are not properly going to a new line in the window. Despite adjusting the width, the messages continue to overlap. Below is the code snippet: This co ...

Error Encountered While Creating a Polygon Wallet on Fireblocks

After following the instructions from Fireblocks Docs, I successfully created a default wallet named "BTC_TEST" like this: enter image description here. However, when attempting to create a Matic wallet, I encountered an Axios Error. Despite Matic being a ...