ng-sticky-element
v0.1.0
Published
Angular directive to make HTML elements sticky when scrolling
Downloads
52
Maintainers
Readme
ng-sticky-element
Angular directive to make HTML elements sticky when scrolling.
Usage
bower install ng-sticky-element --production
# or
npm install ng-sticky-element --production
Include main files:
<link rel="stylesheet" href="bower_components/ng-sticky-element/dist/ng-sticky-element.min.css">
<script src="bower_components/ng-sticky-element/dist/ng-sticky-element.min.js"></script>
Include afklStickyElement
module as a dependency into your app:
angular
.module('yourApp', [
'afklStickyElement'
]);
Place afkl-sticky-element
attribute onto element:
<div afkl-sticky-element>I am now sticky.</div>
<!-- with optional attributes:
afkl-sticky-element="bottom"
afkl-sticky-element-offset="24" // offset in px
afkl-sticky-element-mq="(min-width: 640px)" // applies stickiness only if given media-query is true
-->
Browser Support
All modern browsers & IE versions newer than 9 are supported. IE9 should also be fine in case you polyfill matchMedia
.
Development
- Clone the repo or download.
npm install && bower install
- Setup E2E testing environment:
npm install -g protractor && webdriver-manager update --standalone
- Make the selenium driver up:
webdriver-manager start --standalone
and rungulp build
- Run
gulp watch
, navigate to http://localhost:8080/demo/index.html and play on /src - Make sure that tests are up and green:
gulp test-unit
orgulp test-e2e
License
MIT