popular-message.js Library Examples

Download Back To CSSScript.Com

a JavaScript library that helps create toast-like info/success/warning/error notifications and loading indicators on your modern web apps.

Basic Usages

$message.info('This is an info message')
$message.success('This is a success message')
$message.warning('This is a warning message')
$message.error('This is an error message')
$message.loading('Loading...')

With Options

$message.info({
    content: 'Any Text Here'
})
$message.info('Auto Dismiss After 2 Seconds',{
    onClose:() => console.log('Close'),
    closable: true,
    duration: 2
})

$message.info('Always Shown',{
    onClose:() => console.log('Close'),
    closable: true,
    duration: 0
})
$message.config({
    top:85,
    duration: 4
})
$message.destroy()
$message.config({
    singleton:true
})
$message.info('This is a Singleton message.')
// default
$message.info(htmlStr,{ duration: 0, closable: true })
$message.info(htmlStr,{
    dangerUseHtml: true,
    duration: 0,
    closable: true
})