@widget-kit/container-plugin-position-fixed
v1.0.0
Published
Control iframe position from widget within iframe
Downloads
13
Maintainers
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
: aContainer
instance returned bycreateContainer
.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).