iosOverlay.js — iOS-style overlays/notifications for the web


Fork & Download on GitHub

Examples

The following all have a two second duration:

 

It's possible to update a notification when it's already been added:

Parameters and Defaults

Parameter Default Value Accepts Type
onbeforeshow noop(); Function
onshow noop(); Function
onbeforehide noop(); Function
onhide noop(); Function
text null String
icon null String (file path)
spinner null Spinner (via Spin.js)
duration null Number (ms)

Methods

Method Description/Use
hide Call this to begin the hide animation.
  // notification is called
  var notification = ...;

  // something happens

  // fade out notification and destroy on complete
  notification.hide();
update Used to update the contents of a notification on the fly. Accepts text and icon in formats as table above denotes. Accepts one or both.
  // notification is called
  var notification = ...;

  // something happens

  // notification is updated
  notification.update({
    text: "Success!",
    icon: "img/smiley.png"
  });

Browser Support

Optional Dependencies

Tips & Tricks