I am calling a function when user scroll to the bottom.
In my case function is called when scroll reaches top instead of bottom. Working in reverse order.
Make a file with name " scroll.html " and copy my code below and past it in that file. You will find the bug
Please help fixing this issue in file instead of fiddle.
Because my code works perfect in fiddle. I want to know what is the problem with my document ?
Code :
<html>
<head>
<script src="http://code.jquery.com/jquery-2.0.2.js"></script>
</head>
<body>
<script>
$(document).ready(function () {
$(window).scroll(function () {
if ($(document).height() == $(window).scrollTop() + $(window).height()) {
alert('You\'ve reached the bottom');
}
});
});
</script>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
</body>
</html>
Please do make an HTML file of it. And then test it.
` tag in one of my templates and it works like it should but without `$(document).ready(function () {`.
– Milan and Friends Dec 04 '13 at 14:13