I want to check if element is in viewport. I've taken the following approach:
In html...
<html ng-app="myapp">...
<div ng-if="IsElementInViewport(this)"></div>
In js...
$scope.IsElementInViewport= function (el) {
console.log(el);
return true;
}
In console...
Object { $$childTail: Object, $$childHead: Object, $$nextSibling: Object, $$watchers: Array[9], $$listeners: Object, $$listenerCount: Object, $$watchersCount: 11, $id: 215, $$ChildScope: b(), $parent: Object, 9 more… }
My challenge is how to convert or see the passed-in el
as a JQuery element (or equivalent) where I can, for instance, do $elem.offset().top
. That would resolve my problem.