Skip to content

A simple Angular.js directive to create "Back to top" button when user reaches the end of the page.

License

Notifications You must be signed in to change notification settings

edappy/angular-backtop

 
 

Repository files navigation

angular-backtop Build Status

A simple Angular.js directive to create "Back to top" button when user reaches the end of the page.

You can see a working demo here.

Installation

Assuming that you already have Angular.js in your app, include angular-backtop.js and angular-backtop.css.

Add directive as your dependency:

var app = angular.module('app', ['angular.backtop']);

Create directive element somewhere inside of your tag:

<back-top></back-top>

... and thats all, you have a basic button, that will appear when you start scrolling the page. Click on it to be redirected to the top.

Options

You can pass some more options to the directive.

  • scroll-speed - Speed in miliseconds, default value is 600
  • button-theme - Themes for button, there is bootstrap, dark & light. Default it light.
  • button-text - Text, that will be displayed inside of a button. Default is Scroll top.

Example:

 <back-top scroll-speed=600 button-theme="light" button-text="Take me back"></back-top>

Tests

npm install
grunt karma:unit

About

A simple Angular.js directive to create "Back to top" button when user reaches the end of the page.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 89.7%
  • CSS 7.3%
  • HTML 3.0%