Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chemzqm/align
align two elements with position
https://github.com/chemzqm/align
Last synced: about 1 month ago
JSON representation
align two elements with position
- Host: GitHub
- URL: https://github.com/chemzqm/align
- Owner: chemzqm
- Created: 2016-03-12T11:51:37.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-03-12T18:33:45.000Z (almost 9 years ago)
- Last Synced: 2024-10-29T12:33:19.589Z (about 2 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: history.md
Awesome Lists containing this project
README
# Align
Align one element to another with specified position and offset.
## Install
npm install component-align
## Example
``` js
var align = require('component-align')
var yellow = document.getElementById('yellow')
var blue = document.getElementById('blue')
align(yellow, blue, 'bl-tl')
```## API
### align(fromEl, toEl, [position], [offset])
* position should be `[pos]-[pos]`, pos could be 'tl', 'tc', 'tr', 'bl', 'bc', 'br', 'lc', 'rc'
* offset could contain x and y as number in pixel.