setting up some data tables using jquery ui tabs , setting fixed height and using your scrollbar, question is on each tab click , can this scroll bar be reset to top of the div or table , currently on tab click the next tabs content is scrolled down to where previous tabs content was being used
Yes it's possible doing something like this:
var el = new SimpleBar(document.getElementById('myElement'));
el.SimpleBar.getScrollElement().scrollTop = 0;
When i console el.SimpleBar am getting undefined.Can any one help me?
Code:
var el = new SimpleBar(document.getElementById('myElement'));
console.log(el.SimpleBar); //undefined
For anyone, who stumbles upon this in future. el.SimpleBar is not defined anymore. el is the SimpleBar element. So use it like this:
el.getScrollElement().scrollTop = 0;
<div id="listing-container" data-simplebar data-simplebar-auto-hide="false">
<div>data here</div>
</div>
function scrollIt() {
const scrollElement =
document.getElementById('listingcontainer').SimpleBar.getScrollElement();
scrollElement.scrollTop = 1200;
}
I'm getting el.getScrollElement() == undefined
I'm getting el.getScrollElement() == undefined
Me too, any help?
Most helpful comment
When i console el.SimpleBar am getting undefined.Can any one help me?
Code:
var el = new SimpleBar(document.getElementById('myElement'));
console.log(el.SimpleBar); //undefined