Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

"Cannot read property 'scrollTop' of undefined"

$
0
0

@Kole wrote:

Trying to work with this codepen but running into the error "Cannot read property 'scrollTop' of undefined"

Here's my directive

.directive('scrollWatch', function($rootScope) {
return function(scope, elem, attr) {
var start = 0;
var threshold = 150;

elem.bind('scroll', function(e) {
  if(e.detail.scrollTop - start > threshold) {
    $rootScope.slideHeader = true;
  } else {
    $rootScope.slideHeader = false;
  }
  if ($rootScope.slideHeaderPrevious >= e.detail.scrollTop - start) {
    $rootScope.slideHeader = false;
  }
  $rootScope.slideHeaderPrevious = e.detail.scrollTop - start;
  $rootScope.$apply();
});

};
})

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>