0

I have the following code, but not work in chrome

var win = $(window);
($(document).height() - win.height() == win.scrollTop()) 

I searched the Internet and found with the 'body' now works however are run at the top of the page, how do I run to get to the bottom of the page?

($(document).height()  - $('body').height() == $('body').scrollTop())
Jed Fox
  • 2,979
  • 5
  • 28
  • 37
Fernando josé
  • 229
  • 2
  • 10
  • Possible duplicate of http://stackoverflow.com/questions/4249353/jquery-scroll-to-bottom-of-the-page – Bharat Oct 04 '16 at 10:40

2 Answers2

0

You need call your functionality after document ready.

$(document).ready(function(){
    var win = $(window);
    ($(document).height() - win.height() == win.scrollTop()) 
})
JJJ
  • 32,246
  • 20
  • 88
  • 102
Andrew Z
  • 139
  • 4
0

Get the document height using and scroll to the bottom using .scrollTop();

 var height=$(document).height();
 $('body').scrollTop(height)
Ashok kumar
  • 514
  • 1
  • 5
  • 18