I want to perform a function when the scrollWidth
value change on a property using vanilla JavaScript.
I tried the following but that does not work
var container = document.getElementById('my-container');
container.addEventListener('change', function (e) {
if (e.offsetHeight < e.scrollHeight) {
// Do something
}
});
I also tried
var container = document.getElementById('my-container');
container.watch('scrollWidth', function (e) {
// do something with container
});
But none seem to be working. How can I correctly watch for a change in the scrollWidth
property of the container
?