1.0.5 • Published 8 years ago

align-to v1.0.5

Weekly downloads
4
License
-
Repository
github
Last release
8 years ago

align-to

Align the specified elements.

1

align(blue).to(yellow, ['TL', 'BL']);

Synopsis

var align = require('align-to')
align(element).to(target, [from, to], options);

Usage

The code above will coincide the from point of element with the to point of the target.

element

type Element|jQueryElement, the element to be placed.

target

type Element|jQueryElement|'viewport', the target which element will be aligned to.

from, to

type String, the symbol of a specific point

There are 7 points for a single rectangle:

TL ----------- TC ----------- TR
|                              |
|                              |
|                              |
|                              |
LC             CC             RC
|                              |
|                              |
|                              |
|                              |
BL ----------- BC ----------- BR

2

align(blue).to(yellow, ['BC', 'BC']);

3

align(blue).to(yellow, ['BR', 'BR'], {
	adjust: {
		top: 5,
		left: 10
	}
});

options

  • left number=0 the horizontal offset
  • top number=0 the vertical offset
  • fix boolean=false if true, the element will be fixed to the destination position.
1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago