DEV Community

riversun
riversun

Posted on

An easy way to display a toast with JavaScript

<!DOCTYPE html>
<html>
<body>
<script src="https://riversun.github.io/jsframe/jsframe.js"></script>
<script>
    const jsFrame = new JSFrame();
    jsFrame.showToast({
        html: 'This is a simple toast', align: 'top', duration: 2000
    });
</script>
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

toast

Here is a simple demo.

And also you can customize like this.

For more details,check library on github.

Top comments (0)