https://github.com/khalidsheet/web-notifications
A small library for web notifications.
https://github.com/khalidsheet/web-notifications
Last synced: 4 months ago
JSON representation
A small library for web notifications.
- Host: GitHub
- URL: https://github.com/khalidsheet/web-notifications
- Owner: khalidsheet
- License: mit
- Created: 2018-10-12T01:04:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-12T02:11:01.000Z (over 7 years ago)
- Last Synced: 2025-10-29T03:51:28.968Z (8 months ago)
- Language: HTML
- Size: 8.79 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Basic Web Notifications
-----
> Create a beautiful Notifications, Messages and Alerts with simple lines of code.
## Installation
* Download all files then import them in your `index.html`
---
## Usage
### Import css and js files
-- CSS file
```html
```
-- JS file
```html
```
### then add this element before the body closing tag
> Don't forget the `notifiable="enable"` attribute.
```html
```
---
## In your JS file
```js
/*
create a new Notification Instance.
it takes three parameters className, id or whatever selector
Notification Tyoe
JOSN object called Options
*/
var notify = new Notification('.whateverClassName', 'type', {
title: '',
body: '',
position: '',
dir: '' // ltr, rtl
});
```
---
## Notification Types
* `primary`
* `secondary`
* `success`
* `info`
* `warning`
* `danger`
---
## Notification Postions
* `top`
* `top-left`
* `top-right`
* `bottom`
* `bottom-left`
* `bottom-right`
---
## Show the notification
```js
notify.show();
```
## Hide the notification
```js
notify.hide();
```
## Notification Methods
```js
notify.show();
notify.showAfter(3000);
notify.hide();
notify.hideAfter(3000);
```