Code Monkey home page Code Monkey logo

vanilla-notify's Introduction

Vanilla Notify

After Playing around with lots Growlesque plugins for jQuery, I came to the impression that whilst they mostly looked nice, they all were very bloated and difficult to customize.

So - of course - I rolled my own! Only this one is different. It's bit like a single scoop of momma's best homemade vanilla in a fancy ice creamshop: it doesn't have curvy corners, or callbacks, or other distractions. It's solid, works well, looks pretty decent and - oh - it's only 20 lines of code!

Being simple means it's very easy to understand and easy to change to your own tastes.

Installation

  • include vanilla-notify.js
  • depends on jQuery (1.3.2 tested)
  • include the following CSS somewhere
#notify { position: absolute; position: fixed; width: 12em; top: 1em; right: 1em; color: black; }
#notify li { margin:0em; line-height: 1em; margin-bottom: 1em; list-style: none; padding: 0.5em 1em; background: #ddd; opacity: 0.85; cursor: pointer;} 
#notify .error  {background: #fcc;}

Calling

Uses the semi-standard $.notify

 $.notify('Hello') 

Can put any html inside

 $.notify('

Hello

Hi there

')

There is also a klass option, which adds the klass to the notification. This class can be used to style

 $.notify('With class: error', {klass: 'error' }) 

There's also a delay, which defaults to 5000. It's the time before the notification fades out. Set it to something big to make it sticky.

 $.notify("I'll be here for 7610.4 years!", { delay: 1e10 }) 

Links

Compatibility

Tested in

  • Firefox 3.5
  • Safari 4

vanilla-notify's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

dineshkummarc

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.