dndalertjs
Version:
DNDAlert is a simple JavaScript library alert for web developers.
75 lines (64 loc) • 1.49 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DNDAlert.js</title>
</head>
<body>
<button onclick="example()">ALERT</button>
</body>
<style>
body {
height: 1890px;
}
</style>
<script src="../DNDAlert.js"></script>
<script>
function example() {
const DNDALERT = new DNDAlert({
title: "Test Alert",
message:
"DNDAlert is a simple JavaScript library alert for web developers.",
type: "info",
html: false,
buttons: [
{
text: "Ok",
type: "primary",
onClick: (bag) => {
alert("Ok button clicked");
},
},
{
text: "Cancel",
onClick: (bag) => {
bag.CLOSE_MODAL();
},
},
],
closeBackgroundClick: true,
portalElement: document.querySelector("body"),
portalOverflowHidden: true,
textAlign: "center",
theme: "white",
onOpen: (bag) => {
console.log("Modal Opened");
console.log(bag.PROPERTIES);
},
onClose: (bag) => {
console.log("Modal Closed");
console.log(bag);
},
opacity: 1,
autoCloseDuration: 3000,
draggable: true,
animationStatus: true,
closeIcon: false,
sourceControlWarning: true,
});
}
</script>
</html>
</html>