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


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
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

适用浏览器:IE8、360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗.

来源:站长素材