Minimal popup API with Promise result, plus SweetAlert-like SVG icon animations powered by xjs.draw() / spring easing.
// SweetAlert-like icons (SVG + draw)
xjs.layer({ title: 'Success', text: 'Saved!', icon: 'success' });
xjs.layer({ title: 'Error', text: 'Something went wrong', icon: 'error' });
// Confirm flow
xjs.layer({
title: 'Delete item?',
text: 'This action cannot be undone.',
icon: 'warning',
showCancelButton: true
}).then((res) => {
if (res.isConfirmed) xjs.layer({ title: 'Deleted', icon: 'success' });
});
<button class="btn success">Success</button> <button class="btn error">Error</button> <button class="btn warning">Warning</button> <button class="btn info">Info</button> <button class="btn">Confirm</button>
/* This page's button styles are local. Layer's own CSS is injected by layer.js */
ESC 关闭(可用 closeOnEsc:false 关闭)。
ESC while the popup is open.
success | error | warning | infotrue (default)true (default)true (default)