Return values of scrollTop()?
Related StackOverflow question.
A user on the SO forums asked about the return values inside jQuery's scrollTop(value). Because the documentation does not specify what this would be I thought they made an error. However, upon investigation I found that the second returned item is the current scrollTop position. But I can't figure out what the first is.
You can see in the code example
here that when scrolling the first value is always zero, the second is the current scrollTop.
1. What is the first value?
2. Is this documented anywhere?
3. Is it often the case that when jQuery has a getter and setter method with the same name that the setter can, by means of a return function, use the getter?
Code in case links go dark:
$(window).scroll(function() { $('body').scrollTop(function(i, v) { console.log(i + ' ' + v); // (v == $('body').scrollTop()) }); });