question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

data-scroll-speed creates jumping elements

See original GitHub issue

Hello 👋

Describe the bug When using data-scroll-speed I’m seeing jumping elements on the first inview appearance.

There is another card that is similar, but not entirely the same.

To Reproduce Steps to reproduce the behavior:

<?php if ( get_row_layout() == 'project_highlight_rows' ) : 
    
    $projects = get_sub_field( 'projects' ); ?>

    <div class="highlighted-projects" data-scroll-section>

        <?php foreach ( $projects as $project ) : 

            $categories = get_the_terms( $project->ID, 'project_categories' );
            $category_name = !empty( $categories ) ? esc_html( $categories[0]->name ) : 'Uncategorized';
            $post_title = get_the_title( $project->ID );
            $post_showcase_image = get_field( 'post_showcase_image', $project->ID ); ?>
        
            <div class="project-wrapper">

                <div class="xw-wrapper">

                    <div class="row align-items-center justify-content-between">

                        <div class="col-lg-4 col-12 project-details" data-scroll data-scroll-speed="-3">

                            <a class="title" href="<?php echo get_the_permalink( $project->ID ); ?>" title="<?php echo $post_title; ?>"><h2><?php echo $post_title; ?></h2></a>

                            <span class="project-details">Quick description of project details</span>
                            
                            <span class="project-tags"><?php echo $category_name; ?></span>

                            <a class="cta-link" href="<?php echo get_the_permalink( $project->ID ); ?>" title="<?php echo $post_title; ?>">
                                <span>View Project</span>
                            </a>

                        </div>

                        <div class="col-lg-6 col-12 project-imagery" data-scroll data-scroll-speed="3">

                            <div data-scroll>

                                <?php the_acf_lazy( $post_showcase_image, 'auto', 'contain' ); ?>

                            </div>

                        </div>
                
                    </div>
                    
                </div>
                
            </div>
            
        <?php endforeach; ?>

    </div>

<?php endif; ?>

Expected behavior I would expect that the smoothing behavior would be smooth.

Screenshots Here is a video.

Desktop (please complete the following information):

  • OS: macOS
  • Browser Chrome
  • Version 87.0.4

Thank you 👊

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:10
  • Comments:13

github_iconTop GitHub Comments

2reactions
sunnylqmcommented, Jul 21, 2021

the default scroll position may be a problem.

Try adding data-scroll-position="top"

2reactions
canadianeaglecommented, Feb 10, 2021

I’ve had the same issue a few times. This fixed it for me - add the data-scroll-target attribute. For example: data-scroll-target="#gallery" would keep the element attached to a div with id gallery and fix the jumping issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Use the Locomotive Scroll for all Kinds of ... - CSS-Tricks
data-scroll-speed : Specifies the speed an element moves. A negative value reverses the direction, but only vertically, unless data-scroll- ...
Read more >
GSAP ScrollTrigger + Locomotive Scroll, data-scroll-speed issue
I'm experiencing an issue with Locomotive Scroll + GSAP ScrollTrigger. As soon as I add a "data-scroll-speed" to an element which is different ......
Read more >
Jumping Elements - javascript - Stack Overflow
The issue here is that when I add function isElementInViewport to the scroll speed. It makes the element jump out of view when...
Read more >
The smooth, Locomotive Scroll in Elementor - no PRO needed!
Locomotive Scroll is cool, everyone can tell you that. It helps you turn any bad or boring layout into a piece of art...
Read more >
Well-controlled scrolling with CSS Scroll Snap - web.dev
Scroll snapping happens after all scroll operations including those initiated by script. When you are using APIs like Element.scrollTo , the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found