Minimal JavaScript Plugin For Android Like Toast Notifications

Category: Javascript , Notification | August 29, 2015
Author: yuanxj1024
Views Total: 2,440
Official Page: Go to website
Last Update: August 29, 2015
License: MIT

Preview:

Minimal JavaScript Plugin For Android Like Toast Notifications

Description:

toast.js is a lightweight, easy-to-use JavaScript library used to show Android like toast notifications on your mobile or desktop web applications.

Basic usage:

Import the toast.js script into your document.

<script src="src/toast.js"></script>

Shows toast notifications with custom messages on your web application. The plugin provides 9 methods to create different types of toast notifications.

window.plugins.toast.showExShortTop(message)
window.plugins.toast.showExShortCenter(message)
window.plugins.toast.showExShortBottom(message)
window.plugins.toast.showShortTop(message)
window.plugins.toast.showShortCenter(message)
window.plugins.toast.showShortBottom(message)
window.plugins.toast.showLongTop(message)
window.plugins.toast.showLongCenter(message)
window.plugins.toast.showLongBottom(message)

Style the toast notifications.

.toastWrap {
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-flex;
  display: -ms-flexbox;
  display: flex;
  z-index: 200;
  position: absolute;
  width: 100%;
  color: #ffffff;
  height: 30px;
  display: none;
  text-align: center;
}

.toastWrap span {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  -moz-box-flex: 0;
  -moz-flex: 0 0 auto;
  -ms-flex: 0 0 auto;
  flex: 0 0 auto;
  border-radius: 5px;
  opacity: 0.8;
  filter: alpha(opacity=80);
  background-color: #000000;
  display: inline;
  margin: 0 auto;
  font-size: 14px;
  padding: 10px;
}

.toastWrap.bottom {
  position: fixed !important;
  bottom: 0 !important;
}

You Might Be Interested In:


Leave a Reply