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 🙏

© 2024 – Pkg Stats / Ryan Hefner

fro-up

v0.4.0

Published

Module for show pop-up banners and modal windows

Downloads

13

Readme

fro-up

Module for show pop-up banners and modal windows.

Getting Started

To install the banner, you can either manually download the repository (https://github.com/froweb/fro-up) or use npm:

$ npm install fro-up --save

Add a custom class to your css file like this:

...
.visually-hidden {
	border: 0;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	white-space: nowrap;
}
...

Then you need to apply the banner HTML code in the right place of your page. The result should look something like this:

<body>
	...
	<button class="some-class">Inquire about the sale</button>
	...
	<div class="fro-up visually-hidden" id="sale">
	...
	  <button class="fro-up__close" aria-label="Close" title="Close">
	  </button>
	</div>
	...
</body>

Add the lines below to your index.js file and the banner will work with default settings!

const FroUp = require('fro-up');
...
const saleBanner = new FroUp('sale');
saleBanner.start('some-class');// don't forget to specify a class for the show button

The default settings do not suit you? You can customize the banner like this:

const FroUp = require('fro-up');
...
const saleBanner = new FroUp('sale', 4, true);
saleBanner.start();

or

const FroUp = require('fro-up');
...
const saleBanner = new FroUp();
saleBanner.options = {
  id: 'sale',
  interval: 4,
  block: true,
}
saleBanner.start();

Settings

|Setting|Default Value|Type|Description| |---|---|---|---| |id|no default|String|ID selector for the banner| |interval|0|Number|Delay time (in seconds) before the banner is shown| |block|false|Boolean|Blocking scrolling on the page| |escEvent|true|Boolean|Closing the banner by pressing the ESC key| |autoFocus|true|Boolean|Autofocus on banner elements|

Important features

The popup with timer will not work if another open banner includ a fro-up class. Example:

const FroUp = require('fro-up');
...
const saleBanner = new FroUp('email', 0, true);
saleBanner.start('email__btn');// if the banner is shown by the button
const saleBanner = new FroUp('sale', 4, true);
saleBanner.start();// the timer expires, then the second banner will not be shown

If autoFocus = true, then the first input element of the active banner gets focus. If there are no input elements, focus will go to the first textarea. if the banner does not contain input or textarea, the focus will go to the element with class="fro-up__body".

Demos

coming soon ...

License

ISC