GithubHelp home page GithubHelp logo

commadelimited / sticky Goto Github PK

View Code? Open in Web Editor NEW
33.0 5.0 5.0 151 KB

Seriously simple notifications for jQuery

Home Page: http://andymatthews.net/code/Sticky/

License: GNU General Public License v2.0

CSS 8.41% JavaScript 76.57% HTML 10.55% SCSS 4.48%

sticky's Introduction

Sticky

A simple, lightweight notification plugin for jQuery.

Overview

Sticky allows developers to quickly and easily display messages to users via a simple and streamlined notification center. Sticky is unique in that it groups multiple messages together to help keep your beautiful interface clutter-free.

Sticky is only 1.3k for the minified version and 3.1k for the full.

Installation

Using Sticky is easy.

  • Include jQuery, sticky.min.js, and sticky.css
  • Send messages!

Usage

Plain note, default options

$.sticky('I am a plain text note. Nothing special about me.');

Plain note, default options, html content

$.sticky('<b>Greetings</b>. I am an HTML note.');

Plain note, default options, custom callback function

$.sticky('I am a plain text note. I'll tell you good job!.', callback);

Overriding classList and speed

$.sticky('Upload complete', {classList: 'success', speed: 'slow'});

Overriding position

$.sticky('I'm at the bottom! Look at me!, {position: 'bottom-center'});

Overriding classList with warning class.

$.sticky('Careful, there be dragons ahead', {classList: 'warning'});

Overriding classList, making note stay open.

$.sticky('I give up, it just won't work.', {classList: 'important', autoclose: 0});

Overriding classList, allowing no duplicates.

$.sticky('I just wanted you to know', {classList: 'info', allowdupes: false});

Sticky takes an optional callback function which receives an object containing information about the note just added:

$.sticky(note, options, function(response) {
    JSON.stringify(response);
});

var response = {
    'id': uniqID, // Generated ID, a hash of the message contents.
    'duplicate': duplicate, // whether this note was a duplicate
    'displayed': display, // whether the note was displayed
};

Configuration

var options = {
    position: 'top-right', // top-left, top-center, top-right, bottom-left, bottom-center, or bottom-right
    speed: 'fast', // animations: fast, slow, or integer
    allowdupes: true, // true or false
    autoclose: 5000,  // delay in milliseconds. Set to 0 to remain open.
    classList: '' // arbitrary list of classes. Suggestions: success, warning, important, or info. Defaults to ''.
};

Building locally, running unit tests

So you'd rather build your own copy of Sticky, or want to run the unit tests? To get started running them please take the following steps:

image

Okay, for real. Do these things:

  1. Download this repo
  2. Run npm install
  3. Run grunt

This will compile the new CSS and JS files into the dist directory.

Contributing

You are invited to contribute code and suggestions to this project. The more the merrier.

Project Info

3rd party libraries required:

  • jQuery: MIT/GPL license

Custom bits:

MIT/GPL license

Bitdeli Badge

sticky's People

Contributors

commadelimited avatar thrivingkings avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.