I'm developing the popup window of my Chrome extension. I bind a callback in scroll event of a div
with selector like this:
$('#activity-tab .activity-list').bind('scroll', () => {
if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight){
// My code goes here
}
);
But it interprets this
as the Window
in popup, not the element with selector itself. I have to change my code into this to make it work properly:
But
$('#activity-tab .activity-list').bind('scroll', () => {
let element = $('#activity-tab .activity-list');
if (element.scrollTop() + element.innerHeight() >= element[0].scrollHeight){
// My code goes here
}
);
Why doesn't this
work properly in Chrome popup environment?