New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dom-fit

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-fit

Fit a DOM element into another

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

dom-fit

Fit a DOM element into another

Installation

With npm do:

$ npm install dom-fit --save

Install with component(1):

$ component install nk-components/dom-fit

Usage

var domFit = require('dom-fit');
var inner = document.querySelector('#inner');
var outer = document.querySelector('#outer');

var fit = domFit(inner, outer, {
  /**
   * If the module listen `resize` event.
   * If it's set to false, you have to call `.resize()`.
   *
   * Optional
   * @type Boolean
   */
  autoResize: false,
  /**
   * If the element is not visible or not added to the DOM,
   * its width & height will be equal to 0.
   * You can specify its default size to be able to resize
   * the element before to add it to the DOM.
   *
   * Optional
   * @type Float
   */
  defaultWidth: null,
  defaultHeight: null,
  /**
   * Contain or cover the parent.
   *
   * Optional
   * @type Boolean
   */
  contain: true
});

// autoResize === false, then we have to call `.resize()`
// to fit the inner element.
fit.resize();

License

The MIT License (MIT)

Keywords

FAQs

Package last updated on 20 Dec 2014

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