0

i am using this code in my html page for loading more data when user scroll to the bottom of page.

if($(window).scrollTop() + $(window).height() == $(document).height())  //user scrolled to bottom of the page?

i have also tried this:

if($(window).scrollTop() + $(window).innerHeight() == $(document).innerHeight())  //user scrolled to bottom of the page?

i don't now what is wrong with ie8 but it dose not work on it. is there any way to make it run?

update seems like problem was from .scrolltop() i find a code on the web and replace it like this:

var sTop = document.body.scrollTop || document.documentElement.scrollTop || window.pageYOffset || 0;
if(sTop + $(window).height() == $(document).height())  //user scrolled to bottom of the page?

it worked, but i have no idea about the first line and just copied it.is this standard? can it be used?

the110boy
  • 71
  • 8
  • IE8? Are you serious? I'm so sorry, bro :-( – gen_Eric Sep 08 '15 at 20:07
  • 1
    Do you really need to support IE8? Microsoft will stop supporting IE8 on January 12, 2016. Most web developers no longer support IE8 unless it's required for some specific reason. – Gregg Duncan Sep 08 '15 at 20:13
  • I know you're using jQuery, but maybe the answers in this question can point you in the right direction: http://stackoverflow.com/q/10059888 – gen_Eric Sep 08 '15 at 20:16
  • Did you debug and see what is wrong? `console.log($(window).scrollTop(), $(window).height(), $(document).height());` – epascarello Sep 08 '15 at 20:42
  • thank guys but i need the code work with IE8. – the110boy Sep 08 '15 at 20:44
  • 1
    I'm sure your top line would work in *real* web browsers. IE 8 is too old and too standards non-compliant. – gen_Eric Sep 09 '15 at 13:26

0 Answers0