Possible Duplicate:
JavaScript OR (||) variable assignment explanation
Can someone help explain what this line does, and how?
var scrollTop = html.scrollTop || body && body.scrollTop || 0;
Possible Duplicate:
JavaScript OR (||) variable assignment explanation
Can someone help explain what this line does, and how?
var scrollTop = html.scrollTop || body && body.scrollTop || 0;
You can think of the logic a bit like this...
if (html.scrollTop > 0) {
    scrollTop = html.scrollTop;
    return;
}
if (body != undefined) {
    if (body.scrollTop > 0) {
         scrollTop = body.scrollTop;
         return;
    }
}
scrollTop = 0;
return;
It is setting the scrollTop variable using a list of priorities.
html.scrollTop if it exists and is greater than zero.body exists and use body.scrollTop if it is greater than zero.0