3

I'm trying to figure out how to use angular-scroll from this source on github:

https://github.com/durated/angular-scroll

I'm still very new to AngularJS and I think I'm having trouble reading in between the lines on this example. I've correctly downloaded angular-scroll using bower, have put it in my index.html, and have injected it as a dependency. What I'm unsure about now is how exactly to use it. If I had a JSFiddle for it I could get it quickly. All I want to do is scroll to an element using its id. I'm currently using $anchorScroll and it's working but I want something smoother.

Any help/examples would be greatly appreciated!

Margaret
  • 273
  • 1
  • 6
  • 14
  • 2
    Could you add a minimal example of how far you have got (and maybe create a jsfiddle) to demonstrate what you have done so far, please. It's difficult to help you without the specific details of your issue. – kkuilla Oct 06 '14 at 14:59

1 Answers1

1

Providing you have followed the steps as you described above it is now a case of simply attaching the directive to the element:

<a href="#title" du-smooth-scroll>Scroll to top</a>

By default this will smooth scroll to the element with the corresponding ID:

<h1 id="title">I am the Scroll target</h1>

Source Code: https://github.com/oblador/angular-scroll/blob/master/example/index.html

Demo: http://oblador.github.io/angular-scroll/

nickf
  • 53
  • 1
  • 7