You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

align-to

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

align-to

Align the specified elements.

1.0.5
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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.

FAQs

Package last updated on 28 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts