Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dom-align

Package Overview
Dependencies
Maintainers
4
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-align

Align DOM Node Flexibly

  • 1.12.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
increased by1.27%
Maintainers
4
Weekly downloads
 
Created

What is dom-align?

The dom-align npm package is used for aligning DOM elements relative to each other. It provides utilities to position elements in relation to other elements or the viewport, ensuring they are properly aligned according to specified rules.

What are dom-align's main functionalities?

Aligning Elements

This feature allows you to align a source element relative to a target element. The `points` configuration specifies which points of the elements should be aligned, and the `offset` configuration allows you to add an offset to the alignment.

const align = require('dom-align');
const source = document.getElementById('source');
const target = document.getElementById('target');
const alignConfig = {
  points: ['tl', 'bl'], // Align top-left of source to bottom-left of target
  offset: [0, 10], // Offset by 10px vertically
};
align(source, target, alignConfig);

Viewport Alignment

This feature allows you to align an element relative to the viewport. The `points` configuration specifies which points of the element and the viewport should be aligned, and the `offset` configuration allows you to add an offset to the alignment.

const align = require('dom-align');
const source = document.getElementById('source');
const alignConfig = {
  points: ['tc', 'bc'], // Align top-center of source to bottom-center of viewport
  offset: [0, 20], // Offset by 20px vertically
};
align(source, window, alignConfig);

Other packages similar to dom-align

Keywords

FAQs

Package last updated on 15 Nov 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc