I want to log the offset of window from the top of document but jquery scroll is not working. Will vanilla javascript scroll event listener work in angular?
app.directive('owlCarouselItem', function($touch, $timeout, $rootScope, $window){
return {
restrict: 'C',
transclude: false,
link: function(scope, element) {
// this is the part of my directive the on scroll event is not firing
$('html, body').on('scroll', function() {
if($(this).scrollTop() == 0){
console.log($(this).scrollTop());
canSwipeDown = true;
}else{
console.log($(this).scrollTop());
canSwipeDown = false;
}
});
restrict: C? are you seriously usingowlCarouselItemas a comment?