customerio-gist-web
Version:
Build beautiful in-app flows with no code and deliver them instantly to your app. http://customer.io
19 lines (15 loc) • 659 B
JavaScript
import { log } from "../utilities/log";
export var positions = ["x-gist-top", "x-gist-floating-top", "x-gist-bottom", "x-gist-floating-bottom", "x-gist-floating-bottom-left", "x-gist-floating-bottom-right", "x-gist-floating-top-left", "x-gist-floating-top-right"];
export function addPageElement(position) {
const element = document.createElement("div");
element.id = position
switch (position) {
case "x-gist-top":
document.body.insertBefore(element, document.body.firstChild);
break;
default:
document.body.insertAdjacentElement("beforeend", element);
break;
}
log('Top & bottom elements injected into page');
}