GithubHelp home page GithubHelp logo

vperron / angular-smoothscroll Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arnaudbreton/angular-smoothscroll

0.0 0.0 0.0 5.38 MB

A directive to get a smooth scroll effect

JavaScript 96.85% CoffeeScript 1.81% CSS 1.34%

angular-smoothscroll's Introduction

angular-smoothscroll

AngularJS directives to get a smooth scroll effect (like this: http://css-tricks.com/examples/SmoothPageScroll/). Pure vanilla JS and jQuery versions.

#How to use it?

Demo

Here is a demo Plunkr: http://plnkr.co/edit/rD0Zgi6rg3Spc2XeVrZf?p=preview

Installation

Build your own copy

  1. Build Coffeescript grunt coffee:dist
  2. Copy generated JS in .tmp folder and include it

Get the last version

Copy the last version from the dist/scripts folder

Via Twitter Bower (https://github.com/bower/bower)

Run bower install angular-smoothscroll in your project

###Add the dependency to your app Declare an AngularJS module with a dependency: app.module('myApp', ['angularSmoothscroll'])

##Vanilla JS (to improve, too fast)

Just declare an HTML link element which will start scroll, add the smooth-scroll directive and pass the target ID: <a smooth-scroll target="target">Scroll to Target</a>

##jQuery version Declare an HTML link element which will start scroll, add the smooth-scroll-jquery directive and pass the target ID: <a smooth-scroll-jquery target="target">Scroll to Target</a>. No target means scroll to top.

You can declare the speed (default is 500): <a smooth-scroll-jquery target="target" speed="1000">Scroll to Target</a>

With both versions, you can declare the offset (default is 100): <a smooth-scroll[-jquery] target="target" offset="30">Scroll to Target</a>

#How to contribute?

  1. Clone this repo
  2. Make your changes
  3. Test them: grunt test
  4. Open a pull-request

#To improve

  1. Vanilla JS implementation which is not working very well
  2. Make the Angular JS unit tests pass (cf. http://stackoverflow.com/questions/16929046/effectively-unit-test-an-angularjs-directive-which-is-manipulating-the-dom?noredirect=1#comment24448390_16929046)

Powered by AngularJS (http://angularjs.org), Yeoman (http://yeoman.io), Grunt (http://gruntjs.com) and Karma (http://karma-runner.github.io/0.8/index.html)

angular-smoothscroll's People

Contributors

vperron avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.