Shashank Vivek
Shashank Vivek

Reputation: 17494

Scroll event not binding inside directive - angular.js

I have made one Plunker where I want to hide To The Top button initially and the show it when the screen is scrolled down. I am not able to capture scroll event inside directive. I have followed below Urls:

  1. Scroll event is not fired inside directive - angular.js

  2. Scroll event is not firing

I have even added the overflow: scroll; class to main div, as per suggested by the second url

What am I missing here

Upvotes: 0

Views: 434

Answers (1)

Stepan Suvorov
Stepan Suvorov

Reputation: 26156

you are not scrolling the element itself. you are scrolling the document, so it should be something like:

$document.bind('scroll', ...)

Upvotes: 1

Related Questions