I was just going through the code of circliful and came across the following lines of code:
function isElementInViewport() {
// Get the scroll position of the page.
var scrollElem = ((navigator.userAgent.toLowerCase().indexOf('webkit') != -1) ? 'body' : 'html');
var viewportTop = $(scrollElem).scrollTop();
var viewportBottom = viewportTop + $(window).height();
// Get the position of the element on the page.
var elemTop = Math.round(circle.offset().top);
var elemBottom = elemTop + circle.height();
return ((elemTop < viewportBottom) && (elemBottom > viewportTop));
}
Now my question is about this one line of code:
var scrollElem = ((navigator.userAgent.toLowerCase().indexOf('webkit') != -1) ? 'body' : 'html');
why incase of webkit browsers the scrollTop() value shoud be of the html
element ??