Vanilla JS Responsive Message Box with Javascript Class
Takane Ichinose
Posted on July 14, 2020
This Message Box is inspired by material design's toast message.
I used the VanillaJS (native Javascript) Class to implement the message box. This may not work on older browsers, due to compatibility issue with native class.
Usage:
- Create MessageBox class instance: let msg = new MessageBox("#id", option)
- Available options (type: Object): a. closeTime // Time before the message box closes (In milliseconds). 0 for persistent b. hideCloseButton // To hide the close button.
- Call the "show" method to show the dialog box. Params: message // The message that will appear on the message box label // The label of the close button (default is "CLOSE"). callback // Callback function
💖 💪 🙅 🚩
Takane Ichinose
Posted on July 14, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.