Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra item added at the bottom #16

Open
angelomelonas opened this issue Feb 6, 2019 · 0 comments
Open

Extra item added at the bottom #16

angelomelonas opened this issue Feb 6, 2019 · 0 comments

Comments

@angelomelonas
Copy link

angelomelonas commented Feb 6, 2019

Using the exact example code, a strange issue is appearing in Chrome. When scrolling to the bottom of the page, after reaching the "Vue Loop" white page, an additional item ("1") is added. This causes an undesirable effect of reaching the "Vue Loop" page, followed by "1" and then "Vue Loop" again as the scroll bar jumps to the top.

<div class="loop-container full">
      <div class="item" style="background: white;"><h1>Vue Loop</h1>
        <p>Go for a scroll to try.</p></div>
      <div class="item">
        1
      </div>
      <div class="item">
        2
      </div>
      <div class="item">
        3
      </div>
      <div class="item">
        4
      </div>
      <div class="item" style="background: white;"><h1>Vue Loop</h1>
        <p>Go for a scroll to try.</p>
      </div>

     <!-- This item is added additionally. -->
      <div class="item">
        1
      </div>
</div>

Playing around with the Vue Loop code a little, I managed to "fix" the issue by removing the +1 here:

makeDuplicates() {
...
     for(var i = 0; i < division + 1; i++) {
              container.appendChild(container.childNodes[i].cloneNode(true));
     }
...

I doubt this is the correct way to resolve this issue. I have not been able to spend a lot of time investing the Vue Loop code logic further, but it seems that it only exists in the Vue-Loop code, and not the original pure JS code.

Am I the only one experiencing this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant