Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/snowfire/flash
A lightweight jQuery plugin for discrete flash messaging
https://github.com/snowfire/flash
Last synced: about 9 hours ago
JSON representation
A lightweight jQuery plugin for discrete flash messaging
- Host: GitHub
- URL: https://github.com/snowfire/flash
- Owner: snowfire
- Created: 2015-07-26T10:47:28.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-28T23:35:44.000Z (about 9 years ago)
- Last Synced: 2024-10-10T18:24:26.766Z (26 days ago)
- Language: JavaScript
- Size: 152 KB
- Stars: 3
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Flash
**See an example at http://snowfire.github.io/flash/**
Snowfire Flash is a tiny (0.3KB!) jQuery plugin which allows you to produce quick, Google-like flash messages. If you add the default class, you'll get some styling included. If you would rather use your own selector, you can have a look at the CSS file and just cope that over to your class to achieve the same effect.
## Dependencies
SF Flash relies on [Animate.css](https://github.com/daneden/animate.css) for the animations, as well as jQuery. Animate.css is set as a bower dependency, and will hence be included by default. jQuery, however, is not, since we believe it is the user's choice whether to use it from a CDN, Bower, NPM or any other source.
## Installation
The recommended way to use this plugin is through bower. You can easily install it using
```
bower install sf-flash
```Alternatively, download the minified js and css (if you want to use it) from this repository.
Once you have the file(s), simply import them and run the `sfFlash()` function on your jQuery object!
## Usage
To use the package, you need to insert the actual flash message on the page where you want it. Usually, this would be done on success, often checked server-side. Hence, a PHP implementation could look something like this:
```html
= $_SESSION['flash'] ?>$('.sf-flash').sfFlash();
```
## Options
The plugin also supports a few options to be passed in.
- *delay (50)* – The number of milliseconds before the script runs
- *duration (5000)* – The number of milliseconds that the flash message should be displayed