Skip to content

theajack/webapp-box

Repository files navigation

Web Application Container

Online examples | Version Log

quickstart

npm i webapp-box
import WebappBox from "webapp-box";

let index = 0;
function createDiv() {
    let div = document.createElement('div');
    div.innerText = ++index;
    return div;
}

// add dom
WebappBox.add(createDiv());
setTimeout(() => {
    WebappBox.add(createDiv()); // add another
}, 1000);

// return container
const container = await WebappBox.add();
container.appendChild(createDiv());

config

WebappBox.config({
    width: 600, // Set box container width
    height: 0.5, // Set box container height
    clickMaskClose: true, // 
})

When setting the width or height, greater than 1 indicates px and less than 1 indicates a percentage