AngularJS directive for ScrollToFixed
- AngularJS
- ScrollToFixed
- Firefox 3+, Google Chrome 10+, Safari 5+, Internet Explorer 8/9, and Opera 11.60+.
We use karma and jshint to ensure the quality of the code. The easiest way to run these checks is to use grunt:
npm install -g grunt-cli
npm install
bower install
grunt
The karma task will try to open Chrome as a browser in which to run the tests. Make sure this is available or change the configuration in test\karma.conf.js
bower install scrolltofixed-ng --saveFirst, read the documentation of ScrollToFixed.
We use bower for dependency management. Install and save to bower.json by running:
bower install srolltofixed-ng --save
This will copy the ui-date files into your components folder, along with its dependencies.
Load the script files in your application:
<script type="text/javascript" src="components/angular/angular.js"></script>
<script src="bower_components/ScrollToFixed/jquery-scrolltofixed.js"></script>
<script src="bower_components/scrolltofixed-ng/src/scrolltofixed.js"></script>
Add the date module as a dependency to your application module:
var myAppModule = angular.module('MyApp', ['scrolltofixed-ng'])
Apply the directive to your form elements:
<div scroll-to-fixed> </div>
scroll-to-fixed defines the options to pass to ScrollToFixed.
You can specify them via a plain object in your templates:
<div scroll-to-fixed="{ bottom: 0 }">ScrollToFixed</div>or a scoped object in your controllers:
$scope.options = {
bottom: 0
};<div scroll-to-fixed="options">ScrollToFixed</div>Or Setting at config app
.config(function (stfConfig){
stfConfig.marginTop = 120;
}) ng-model defines the object to watch and triggers a resize event on ScrollToFixed when this object changes.
update triggers a resize event on ScrollToFixed.
$destroy triggers a detach.ScrollToFixed event on ScrollToFixed.
scrolltofixed-ng is released under the MIT license.