I am having trouble with jQuery functionality on my website. What it does, is that it uses the window.scroll()
function to recognize when the windows changes its scroll position and at the change calls a few functions to load data from the server.
The problem is the .scroll()
function is called as soon as there is even a little change in the scroll position and loads data at the bottom; however, what I wish to achieve is to load new data when the scroll/page position reaches at the bottom, like it happens for Facebook feed.
But I am not sure how to detect scroll position using jQuery?
function getData() {
$.getJSON('Get/GetData?no=1', function (responseText) {
//Load some data from the server
})
};
$(window).scroll(function () {
getData();
});
You can extract the scroll position using jQuery's
.scrollTop()
methodThis is another way of getting the value of scroll.
Now that works for me...
it works well... and then you can use JQuery/TweenMax to track elements and control them.
You can add all pages with this code:
JS code:
CSS CODE
Store the value of the scroll as changes in HiddenField when around the PostBack retrieves the value and adds the scroll.
Check here DEMO http://jsfiddle.net/yeyene/Uhm2J/