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.

ScrollTop allways 0

See original GitHub issue

I have this modal where Simple bar is initiated and a form is displayed. el = new SimpleBar($('.fullModal .modal-body')[0]);

When the modal is closed and opened again, the scroll bar remains where it was last placed.

console.log(el.getScrollElement().scrollTop); Reveals that no matter where the scroll bar is placed it is set to 0, and when I try to set it equal to some value, it ignores it completely.

I need to be able to set scrollTop = 0 and have it actually got to the top.

Thank you for your work. Santiago.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Grsmtocommented, Jan 9, 2020

@Cyrus-d you are doing getContentElement instead of getScrollElement.

0reactions
abishekrsrikaanthcommented, Jul 14, 2020

@ppazos, I have the same issue and I cannot use the getScrollElement for the same reason. @Grsmto, can you please look into this and solve this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

element.scrollTop always returns 0 - Stack Overflow
When an element content does not generate a vertical scrollbar, then its scrollTop value defaults to 0." Since the content of inner doesn't...
Read more >
My scrollTop value is not working? scrollTop, offsetTop ...
I've carelessly asked for the scrollTop position of an element and it would always return 0 . In this case, I have to...
Read more >
ScrollY is always equal to 0 · Issue #2329 · nuxt/nuxt.js - GitHub
Hi all, I'm building a folio using Nuxt and Contentful, and I am encountering some issues on how to get the current vertical...
Read more >
scrollTop in iFrame always returns 0 - jQuery - Bug Tracker
scrollTop () in iFrame always returns 0. To reproduce, load an iFrame from a secondary page. In the iFrame page, specify a scroll...
Read more >
2891 - document.documentElement.scrollTop always returns ...
scrollTop always returns zero and can't be set. Reported by schedule broth. ... The scrollTop property remains zero and scroll position does not...
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