Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code on scroll event is not executing if window is zoomed in/out in chrome

I'm using below script to load data on scroll reaches bottom of the page and its working fine in all browsers. But it doesn't seems working in chrome if i manually zoom in / zoom out window using keyboard shortcuts Ctr+ or Ctrl-(> or < default zoom ).

if (($(window).scrollTop() + $(window).innerHeight()) >= $(document).height()){ 
    loadData();
 }
like image 305
Prasanth K C Avatar asked May 19 '15 08:05

Prasanth K C


1 Answers

This seems to be a bug in chrome and i have reported this here>>

Even, i made it working by applying a small height reduction (-100) to satisfy the condition little before it reaches the scroll end.

code goes like this,

if (($(window).scrollTop() + $(window).innerHeight()) >= $(document).height()-100){ 
    loadData();
 }

EDIT

Chrome developers gives following suggestion in the bug linked above.

$(window).scrollTop() + $(window).height() >= $(document).height()
  • Not tested yet from my side.
like image 148
Prasanth K C Avatar answered Sep 28 '22 16:09

Prasanth K C