How do I know (target.scrollHeight - target.scrollTop +1).toFixed(0) >= target.clientHeight.toFixed(0) its greater than by only 1 than return true if its greater than 1 or any other value than it will return false.
I was trying this code...
const handleScroll = (event) => {
const target = event.target;
if ((target.scrollHeight - target.scrollTop).toFixed(0) === target.clientHeight.toFixed(0)) {
let pageNo = page + 1;
if (pageNo <= pageCount) {
fetchSuppliers(data , pageNo);
setPage(pageNo);
}
}
};
This code is not working on some chrome cause in some big screen resolution the value is 201 === 200 so that time this code not working..**
so i have to try the greater than or equal condition but here has a fallback cause the left value will change on scroll like 800 >= 200 its giving true but i want when the value 201 or 202 >= 200 then it should return true otherwise return false
Help me on this regards Thank you all