npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

overlay-as-promised

v0.3.12

Published

jQuery plugin: Full-configurable overlay returning promises on listening events

Readme

OverlayAsPromised - jQuery Plugin

Release with Dependencies !!!

If you include the jquery.overlay-as-promised.min.js only, be sure jQuery and jQuery.colorbox are part of your Project.
You will get them here:

  • http://jquery.com/download/
  • http://www.jacklmoore.com/colorbox/

Install - Demo

  • Download
  • npm install

Run - Demo

  • node server.js
  • Open your browser at localhost:1234

API

var overlay = $(selector).overlayAsPromised(config, onOpen, onClose);
config: {
  closable:        bool                    -> default: true           -> overlay will be closable by button or extern layer click
  closeButton:     bool                    -> default: false          -> shows close button at overlay's bottom
  closeLabel:      string                  -> default: 'Close'        -> label for close button
  closeClass:      string                  -> default: ''             -> css class for close button
  startingDelay:   int                     -> default: 0              -> overlay will be opened after this amount of miliseconds
  minDisplayTime:  int                     -> default: 0              -> overlay will be at least visible for this amount of miliseconds,
  maxDisplayTime:  int                     -> default: 0              -> overlay will be maximal be visible for this amount of miliseconds
  width:           int|string              -> default: false          -> overlay's fixed width
  height:          int|string              -> default: false          -> overlay's fixed height
  maxWidth:        int|string              -> default: false          -> overlay's max width
  maxHeight:       int|string              -> default: false          -> overlay's max height
  top:             int|string              -> default: false          -> overlay's distance to the top of the window
  bottom:          int|string              -> default: false          -> overlay's distance to the bottom of the window
  left:            int|string              -> default: false          -> overlay's distance to the left of the window
  right:           int|string              -> default: false          -> overlay's distance to the right of the window
  className:       string                  -> default: false          -> gives overlay a custom class
  transition:      'elastic'|'fade'|'none' -> default: 'elastic'      -> opening transition type
  speed:           int                     -> default: 350            -> transition speed
  fixed:           bool                    -> default: false          -> fixed position, no scrolling of background
  fitScreen:       bool                    -> default: false          -> whole screen overlay
  autoResize:      bool                    -> default: false          -> trigger resize on dom changes
}

onOpen:            function                -> default: empty function -> will be called on open
onClose:           function                -> default: empty function -> will be called on close
overlay.open()        -> Promise with resolved return value from onOpen
overlay.close()       -> Promise with resolved return value from onClose
overlay.resize()      -> null
overlay.preventOpen() -> null

Note: Auto resizing is not working for Internet Explorer 9 and below

Usage

  • Include jquery.overlay-as-promised.min.js into your Project
var overlay = $('.test').overlayAsPromised({
    closable: true,
}, function() {
    return "it's working";
}, function() {
    console.log("closed");
});

overlay.open().then(function(value) {
    console.log(value);
});

If you declare a startingDelay and want to prevent opening the overlay anyway before the timeout is reached after you called open():

var overlay = $('.test').overlayAsPromised({
    startingDelay: 3000
});

overlay.open();
// do something
overlay.preventOpen();

Customize

For the moment customizing means to override the jQuery.colorbox styles.
To customize the built-in top close-Button simply overwrite the styles of the element with id cboxClose e.g. in your stylesheet:

#cboxClose {
  display: inline-block;
  position: absolute;
  top: 0px;
  left: 0px;
  color: #000;
  border: none;
  background-color: #fff;
}

#cboxClose::before {
  font-family: 'Glyphicons Halflings';
  content: "\e014";
  font-size: 17px;
}

This would result in a black X on white ground (Glyphicons muste be included as font-family).

Contributors