Ian Marshall logo

Ian Marshall

Toast

Cheers! A toast is a UI popup that usually animates in from an edge, then out again.

toast.js puts two functions into global scope.

API

window.toast(text)
Begins the toast animation. The text parameter can actually contain any HTML markup, including images.
window.canToast()
Returns a Boolean if a toast is available or not. If a toast is already animating, this function returns false. If no toasts are currently active, this function returns true.

Styling

The default CSS styling and animation can easily be replaced. The styles array can include any CSS rulesets for the dynamically inserted element <aside id="toast">.

toast.js