1.0.0 • Published 6 years ago

@widget-kit/container-plugin-position-fixed v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

@widget-kit/container-plugin-position-fixed

Control iframe position from widget.

Install

$ npm install --save @widget-kit/container-plugin-position-fixed

Usage

// Main window ("loader" script):
initPositionFixedPlugin(container, {
  initialPosition: {
    top: '0',
    left: '0',
  },
});

// Widget:
const request = setPosition({
  top: '50%',
  left: '50%',
});
widget.send(request);

API Reference

initPositionFixedPlugin(container, [config])

Registers handler for setPosition requests, sets position: fixed for iframe and allows to set initial position.

  • container: a Container instance returned by createContainer.
  • config: allows to set initial position properties (top, left, right, bottom). All properties accept string values (e.g. '200px' or '100%').

setPosition(position)

Creates request with a new position.

  • position: properties that would be changed (top, left, right, bottom).