Kenny Kenny - 1 year ago 211
AngularJS Question

Angular-Scroll: same as example, but not working (Plunker)

I'm trying to use Angular-Scroll ( to simply scroll to an

link on the same page, but do it nicely and smoothly. When I couldn't get it to work, I made a super simple setup in Plunker.


If you download the zip of the GitHub, there's an example I'm trying to do in the folder location
. There's really nothing complex, the angular script is basically just finding the container id for the directive to use.

I cannot figure out why my page will not scroll.


<div class="medium-6 columns" du-scroll-container="container">
<a href="#junk" du-smooth-scroll="" du-scrollspy="">Link</a>

<div id="container" class="medium-6 columns" du-scroll-container="">
<div id="junk">LINK JUNK HERE YAY!!</div>



angular.module('scrollDemo', ['duScroll']).
controller('myCtrl', function($scope) {
var container = angular.element(document.getElementById('container'));

Answer Source

I edited your plunker and it seems to be working now. Here is the link.

The problem was that the container div is not the scrollable container that would be the body element to make it work as the scrollable element you can set the max-height of the container so that it will become the scrollable element or remove the du-scroll-container="container" atribute so that it will use the body as the scrollable element.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download