• Stars
    star
    104
  • Rank 323,446 (Top 7 %)
  • Language
    HTML
  • Created about 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Agnostic Javascript Library for Website Notifications

VanillaToasts

Create toasts & notifications on your website with ease. This library is extremely lightweight and depends on no other library. Simply load the script and css to your page, and use the simple API to start launching toasts on your page.

Check it out: http://alexkvazos.github.io/VanillaToasts/

Installing

$ npm install vanillatoasts

var VanillaToasts = require('vanillatoasts');

Don't forget to include the CSS file!

 <link rel="stylesheet" href="/path/to/vanillatoasts/vanillatoasts.css">

Usage


// Create a toast
let toast = VanillaToasts.create({
  title: 'Welcome to my site',
  text: 'This toast will hide after 5000ms or when you click it',
  type: 'warning', // success, info, warning, error   / optional parameter
  icon: '/img/alert-icon.jpg', // optional parameter
  timeout: 5000, // hide after 5000ms, // optional parameter
  callback: function() { ... } // executed when toast is clicked / optional parameter
});

// Hides the toast instantly
toast.hide()

// Timeout a toast at a later time
VanillaToasts.setTimeout(toast.id, 1000);

Positioning the toast

To set a different position for the toast, use the positionClass property on the options of VanillaToast.

// Create a toast
let toast = VanillaToasts.create({
  title: 'Welcome to my site',
  text: 'This toast will hide after 5000ms or when you click it',
  positionClass: 'bottomLeft'
});

You can use any of the following values for the positionClass property:

  • topRight
  • topLeft
  • topCenter
  • bottomRight
  • bottomLeft
  • bottomCenter

More Repositories

1

MinecraftChat

MinecraftChat's Main Website - Chat on any 1.8 Minecraft Server from your computer or phone!
JavaScript
4
star
2

VanillaSticky

Fix elements to the viewport when they scroll past a position. No jQuery!
JavaScript
4
star
3

javascript-next-snippets

The last Javascript 2017 & React Sublime snippets package you will ever need.
3
star
4

alexcavazos.com

My personal website.
TypeScript
2
star
5

sublime-oceanic-next-dark

Oceanic Next (ES2017) sublime color scheme with a dark (tomorrow night) approach
1
star
6

remix-blog

Remix Developer Blog Tutorial
TypeScript
1
star
7

my-next-auth-app

TypeScript
1
star
8

MinecraftChatMobile

MinecraftChat Mobile Application
JavaScript
1
star
9

rails-blog

Ruby
1
star
10

deno-examples

Learning deno by examples
TypeScript
1
star
11

5950x

Is the AMD Ryzen9 5950x Available?
JavaScript
1
star
12

remix-jokes

Remix Jokes Tutorial
TypeScript
1
star
13

EpicReactDev

My progres in the epicreact.dev course
HTML
1
star
14

SublimePackages

My Sublime Text User Packages folder
1
star
15

RecipeApp

Playing around with SwiftUI
Swift
1
star
16

next-pokemon

JavaScript
1
star
17

HelloFlutter

A hello world flutter app i'm using to learn Flutter.
Dart
1
star
18

code

JavaScript
1
star
19

SpaceShooter

A minimalistic 2D Shoot 'em Up HTML5 game.
JavaScript
1
star
20

hotrails.dev-tutorial

Following along the tutorial at https://www.hotrails.dev/
Ruby
1
star
21

react-effects

JavaScript
1
star
22

my-first-vr-app

TypeScript
1
star
23

Codewars

Code wars katta challengs
JavaScript
1
star
24

leetcode-problems

My leetcode problem solutions
TypeScript
1
star
25

dotfiles

Shell
1
star
26

remix-blog-tutorial

TypeScript
1
star