locomotive-scroll icon indicating copy to clipboard operation
locomotive-scroll copied to clipboard

data-scroll-speed creates jumping elements

Open QuintonC opened this issue 4 years ago • 14 comments

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 👊

QuintonC avatar Jan 08 '21 22:01 QuintonC

Same problem here... any fix?

yepecece avatar Jan 30 '21 21:01 yepecece

Also having this exact issue

niall-forrest-old avatar Feb 04 '21 11:02 niall-forrest-old

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.

canadianeagle avatar Feb 10 '21 03:02 canadianeagle

Having the same issue. But it only occurs when using negative data-scroll values. Also once you scroll passed a jumping element and it is in the "correct position" it stops jumping. So basicly the "starting position" is wrong. Haven't been able to find a fix yet.

Gu2s avatar Feb 23 '21 10:02 Gu2s

I have the same issue. I get jumping elements when using negative data-scroll values.

clmsftsw avatar Mar 17 '21 13:03 clmsftsw

Same issue. Jumping with negative and positive data-scroll values. Seems like initial transforms are not being applied.

connorhvnsen avatar Apr 01 '21 22:04 connorhvnsen

Also having this issue, working on a horizontal scroll direction just with positive scroll values.

theconsigliere avatar Apr 07 '21 13:04 theconsigliere

Also having this issue. Can work around it for now, probably, but would be great to have a fix.

Second @hansenconnor, seems like initial transforms aren't being applied (if data-scroll-speed is negative or positive doesn't affect it).

s-rd avatar Jun 14 '21 07:06 s-rd

the default scroll position may be a problem.

Try adding data-scroll-position="top"

sunnylqm avatar Jul 21 '21 07:07 sunnylqm

+1 I am having the same issue

elliottmangham avatar Sep 20 '21 09:09 elliottmangham

+1 I am having the same issue

ZakaryaNoori avatar Jan 02 '22 10:01 ZakaryaNoori

the default scroll position may be a problem.

Try adding data-scroll-position="top"

Thanks, work for me

felipecava avatar Jul 15 '22 15:07 felipecava

@sunnylqm Thank you! that works for me.

jeronimus23 avatar Jul 30 '22 17:07 jeronimus23

I had the same issue with the negative speed having it move far off its position and jump on first render. I noticed it was when it was outside of its container. Overflow hidden worked perfectly for what I wanted. Which was a 2 column gallery: left scrolling down and right scrolling up.

P-Mattie avatar Apr 28 '24 00:04 P-Mattie