Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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.