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

tether

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tether

A client-side library to make absolutely positioned elements attach to elements in the page efficiently.

  • 2.0.0-beta.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is tether?

The 'tether' npm package is a JavaScript library for efficiently positioning elements on a web page. It allows you to attach elements to other elements, ensuring that they stay in the correct position even when the page is scrolled or resized.

What are tether's main functionalities?

Basic Tethering

This feature allows you to attach an element (e.g., a tooltip) to another element (e.g., a button). The 'attachment' and 'targetAttachment' properties define how the elements are positioned relative to each other.

const Tether = require('tether');

const tether = new Tether({
  element: document.querySelector('#tooltip'),
  target: document.querySelector('#button'),
  attachment: 'top left',
  targetAttachment: 'bottom left'
});

Constraints

This feature allows you to add constraints to the tethered element, ensuring it stays within the bounds of a specified container (e.g., the window). The 'constraints' property takes an array of constraint objects.

const Tether = require('tether');

const tether = new Tether({
  element: document.querySelector('#tooltip'),
  target: document.querySelector('#button'),
  attachment: 'top left',
  targetAttachment: 'bottom left',
  constraints: [{
    to: 'window',
    attachment: 'together'
  }]
});

Offset

This feature allows you to specify an offset for the tethered element. The 'offset' property takes a string with the horizontal and vertical offsets.

const Tether = require('tether');

const tether = new Tether({
  element: document.querySelector('#tooltip'),
  target: document.querySelector('#button'),
  attachment: 'top left',
  targetAttachment: 'bottom left',
  offset: '10px 20px'
});

Other packages similar to tether

FAQs

Package last updated on 30 Sep 2019

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