Skip to content

specifying scrollContainerSelector causes scroll to jump back to the top #89

@nicolaszu

Description

@nicolaszu

Hi,

I'm currently using vue-scrollactive with a custom selector string so that I can use it to scroll a div with overflow. Code looks as as follows:

Navigation Bar

<scrollactive class="my-nav" scrollContainerSelector="#main-scrollable-content">
    <a href="#intro" class="scrollactive-item nav-item ">
      Intro
    </a>
    <a href="#summary" class="scrollactive-item nav-item ">
        Summary
    </a>
</scrollactive>

Overflow Div

<div id="main-scrollable-content" style="{height:'95vh', overflow-y :'auto'}">
   <div id='intro' />
   <div id='summary' />
</div>

I'm getting an issue where clicking on a scrollactive item does scroll down and activate the correct href but it immediately jump back to the top. See Gif:

scrollactive

Would appreciate any help solving this! Happy to submit a PR if someone could point me in the right direction.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions