Stop the stutter in Chrome caused by scrolling animations

I'm encountering a delay with the scroll.Top() function. This issue is specific to Google Chrome on Desktop.

Here is the jQuery code I am using:

$('html, body').animate({ scrollTop: $('#second').offset().top-140 }, 'slow')

I'm trying to identify what might be causing the problem. I came across this post: jQuery Scroll delays (lags) on chrome but smooth on firefox, but the solution provided doesn't work for me as it involves setting the body and html height to 100% which affects document.scroll identification.

Edit:

Below is a minified version of my code (the issue isn't exactly the same as in the shared link but similar): You can view the effect on this link

try3.html:

<!DOCTYPE html>
<html dir="rtl" lang="he">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
        <link rel="stylesheet" type="text/css" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css">
        <script src="https://code.jquery.com/jquery-3.5.1.min.js"
        integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
        crossorigin="anonymous"></script>

        <link rel="stylesheet" href="stylesheets/app.css">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.min.css" integrity="sha512-yHknP1/AwR+yx26cB1y0cjvQUMvEa2PFzt1c9LlS4pRQ5NOTZFWbhBig+X9G9eYW/8m0/4OXNx8pxJ6z57x0dw==" crossorigin="anonymous" />
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick-theme.min.css" integrity="sha512-17EgCFERpgZKcm0j0fEq1YCJuyAWdz9KUtv1EjVuaOz8pDnh/0nZxmU6BBXwaaxqoi9PQXnRWqlcDB027hgv9A==" crossorigin="anonymous" />

        <link href="https://fonts.googleapis.com/css2?family=Alef:wght@400;700&display=swap" rel="stylesheet">
        <title>נוני ופורטונה</title>

    </head>
    <body>
        <Section id="header">

            <div class="scroll-down">
                <svg aria-hidden="true" onclick="$('html,body').animate({ scrollTop: $('#second').offset().top-100}, 'slow')" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 52.6" style="enable-background:new 0 0 100 52.6;" xml:space="preserve">                                 
                    <path class="st0" d="M99.3,1.1c-1-1-2.5-1-3.5,0L49.4,46.7L4.2,0.7c-1-1-2.5-1-3.5,0c-1,1-1,2.5,0,3.5l46.9,47.7
                    c0.5,0.5,1.1,0.7,1.8,0.7c0.6,0,1.1-0.2,1.6-0.6c0,0,0.1-0.1,0.1-0.1L99.3,4.6C100.2,3.7,100.2,2.1,99.3,1.1z"></path>
                </svg>
            </div>

        </Section>
        <div id="second">
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Aperiam quidem nihil ipsum voluptate pariatur laudantium quod praesentium quasi commodi cupiditate sunt esse tempora, odit iusto, reiciendis assumenda tenetur est mollitia.</p>
        </div>
       
        <script src="https://code.jquery.com/jquery-3.5.1.min.js"
        integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
        crossorigin="anonymous"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>

        <script src="scripts/script3.js"></script>
    </body>
</html>

try3.css:

html{
    scroll-behavior: smooth;
    overflow-x: hidden;

}
  
body{
    overflow-x: hidden;
    margin: 0px;
    font-family: 'Alef', sans-serif;
    background-color: #f1ead2;

}

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

  
#header{
    height: 100vh;

    background-color: #00AA6C;
    position: relative;
}
  
#second{
    position: relative;
    margin-top: 10vh;
}


  
  
.scroll-down{
    color: #fff;
    font-size: 400%;
    position: absolute;
    bottom: 4%;
    z-index: 9;
    width: 100%;
    text-align: center;
}

@keyframes upAnddown{
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(15px);
    }
    100% {
        transform: translateY(0);
    }
}
  
.scroll-down svg, #home-gallery .scroll-down svg path {
    width: 60px;
    height: 32px;
    fill: #fff;
    display: block;
    margin: auto;
}

Thank you!

Answer №1

Implemented a JavaScript library known as "ZenScroll" to manage the scrolling functionality and successfully resolved the delay and lag issues.

Marking this post as complete.

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

Conceal a div and label after a delay of 5 seconds with a JavaScript/jQuery function in C#

Here is a sample div: <div class="alert alert-success alert-dismissable" runat="server" visible="false" id="lblmsgid"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> ...

Dynamic drop-down navigation with rearranging menu

I am attempting to design a drop-down navigation bar with 2 rows. Initially, only 1 row is visible. Upon clicking the visible row, both rows should appear. Subsequently, when one of the 2 rows is clicked, only that specific row should be displayed. Below a ...

What are some strategies for efficiently displaying a large amount of data on a screen using Javascript and HTML without sacrificing performance?

Imagine having a hefty 520 page book with over 6,200 lines of text ranging from 5 to 300 characters each. The challenge lies in efficiently displaying this content on the screen for users to read without causing lag or performance issues. Attempting to re ...

Tips on aligning a v-btn alongside v-expansion-panels on the same row

Struggling with aligning my layout. Trying to get a single set of v-expansion-panels and a v-btn in the same row, both visually centered within a card. I managed to almost achieve it in this codepen: https://codepen.io/anzuj/pen/PoPPbdw with the following ...

What is the best way to adjust text to a specific width on an HTML canvas?

Is there a way to adjust the width of a single-line text string precisely on an HTML5 canvas? My current method involves initially setting a font size, measuring the text's width using measureText(my_text).width, and then determining a new font size b ...

What is the CSS selector for the top-level heading?

Is there a way to target the first occurrence of the highest heading element (h*) in a DOM structure? Perhaps something along the lines of (h1, h2, h3, h4, h5, h6):first-of-ordered-set For example, if the DOM contains h2, h3, h1, h2, h1, it should selec ...

Using Perl to pass query information with ajax/json and including scalar reference for DBIx::Class

I am currently facing an issue while trying to pass a query from jquery/ajax/json to a perl script that utilizes DBIx::Class and returns the results. While I have no trouble getting a basic query to function, I encounter difficulties when needing to includ ...

Mastering Instagram Automation: Techniques for Navigating the Lightbox with Selenium

I am in the process of developing a Python script that assists users in Instagram engagement groups by efficiently liking everyone's photo during each round. I am facing an issue where Selenium is unable to click on the first photo when I reach a user ...

What steps should I take to create a collapsible Bootstrap navbar?

I'm attempting to recreate the scrolling functionality seen here: It seems like they might be using a customized Bootstrap Navbar, so I've taken one from here: and tailored it to my needs. How can I achieve the effect where the navigation bar ...

Utilizing the Jackson Framework in Spring Boot for effective mapping with @RequestBody annotation

Hello everyone. I am dealing with some data fetched from a jQuery DataTable and sent to a Spring Controller using Ajax. The ajax function snippet looks like this: $.ajax({ url: "../todaydatarecover.json", t ...

Navigating Modal Pop-ups in Django

My current approach for handling modal windows involves referring to this article here. However, I am struggling with implementing some basic functionality using this method. Within my HTML code, I have the following structure: {% for order in queryset% ...

Cut out a passage by using a polyline shape

I am looking to create a unique effect by clipping a text like a heading1 using an svg polyline. The concept is to place the H1 text behind the polyline background and make it appear frosted or blurred. I have successfully achieved this in the past but see ...

generate a flexible div that adjusts its height based on the size of the browser window

Is it possible to create a div layout structured like this: <div_wrapper> <div_header> </div_header> <div_content> </div_content> </div_wrapper> Upon page load, the div_header o ...

Automatically refresh online user list upon new user login

<?php <div class="someclass"> <ul class="someclass"> foreach ($this->showonline as $key => $friend) { <li> $friend['avatar']; $friend['name']; </l ...

Is there a way to retrieve the dynamically generated text content of an element using document.write?

I am encountering an issue similar to the following: <div id="myDiv"><script>document.write('SOMETHING');</script></div> My goal is to extract the content inside the script tag, which in this case is "SOMETHING" ...

Exploring the Relative Positioning of Two div Elements

Can anyone assist me with finding and comparing the positions of two '<div>' tags using an if statement? I stumbled upon a suggestion in my research, which goes like this: var obstacle = $('#obstacle').css('left', &apo ...

The svh/lvh units are experiencing unexpected issues when using Chrome on an iPhone

I'm facing an issue with my hero section that is supposed to take up the full height of the viewport. I recently tried using the new svh/lvh units, which seemed to work fine on desktop and Safari for mobile. However, when testing on Chrome for mobile ...

"Maximizing revenue with dynamic Adsense integration using

While searching for solutions related to Adsense and AJAX, I came across this, this, and this, but my situation seems slightly different. I don't intend to refresh the Ads every time an AJAX call is made. Let's say I have a page called "mypage.p ...

Why is the toggle functioning properly?

After much trial and error, I finally got my toggle functionality working with the following code. I was surprised that toggling the width actually changed the display settings, but it did the trick! It's still a bit mysterious to me how it all works ...

Improving Rails coupling by integrating AJAX

I am currently in the process of developing a small blog application to enhance my skills with Rails. This app will allow users to log in, create posts, and comment on other users' posts. As of now, I am working on integrating Ajax into the 'add ...