Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

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

44px6MIT1.0.0TypeScript support: included

Control iframe position from widget within iframe

widget, embed, postmessage, iframe, position, popup, chat, widget-kit

readme

@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).

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased] - YYYY-MM-DD

Added

Changed

Fixed