I am attempting to track the window offset from the top of the document, but I am facing issues with jQuery scroll functionality. Can a vanilla JavaScript scroll event listener be used effectively within an Angular environment?
app.directive('owlCarouselItem', function($touch, $timeout, $rootScope, $window){
return {
restrict: 'C',
transclude: false,
link: function(scope, element) {
// The scroll event in my directive is not triggering as expected
$('html, body').on('scroll', function() {
if($(this).scrollTop() == 0){
console.log($(this).scrollTop());
canSwipeDown = true;
}else{
console.log($(this).scrollTop());
canSwipeDown = false;
}
});