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

exit-intent-popup

v1.0.0

Published

A Javscript component to allow for popups before the user exits the page

Downloads

962

Readme

exit-intent-popup

Features

  • Fully customizable via HTML and CSS.
  • Can use third party forms to collect emails.
  • Support for embeddable CSS fonts, including Google Fonts.
  • Cookie support with optional expiry date.
  • Set a timed delay before the script starts tracking exit intent.
  • Display popup based on exit intent or timed delay.
  • Scales to adjust to window size.

Usage

Simply include the script and call its init function with any options you choose. You must add in your own HTML otherwise the popup will be blank.

<script type="text/javascript" src="bioep.min.js"></script>

<script type="text/javascript">
    bioEp.init({
        // Options
    });
</script>

You can also add HTML and CSS directly on the page. The popup element you wish to use must have an id of bio_ep.

<head>
    <script type="text/javascript" src="bioep.min.js"></script>

    <script type="text/javascript">
        bioEp.init({
            // Options
        });
    </script>
    
    <style type="text/css">
        #bio_ep_bg {} // background
        #bio_ep {} // popup
        #bio_ep_close {} // close button
	</style>
</head>
<body>
    <div id="bio_ep">
        <!-- your popup HTML goes here -->
    </div>
</body>

Template

Using HTML and CSS

bioEp.init({
	html: '<div id="bio_ep_content">' +
		'<img src="http://beeker.io/images/posts/2/tag.png" alt="Claim your discount!" />' +
		'<span>HOLD ON!</span>' +
		'<span>Click the button below to get a special discount</span>' +
		'<span>This offer will NOT show again!</span>' +
		'<a href="#YOURURLHERE" class="bio_btn">CLAIM YOUR DISCOUNT</a>' +
		'</div>',
	css: '#bio_ep {width: 400px; height: 300px; color: #333; background-color: #fafafa; text-align: center;}' +
		'#bio_ep_content {padding: 24px 0 0 0; font-family: "Titillium Web";}' +
		'#bio_ep_content span:nth-child(2) {display: block; color: #f21b1b; font-size: 32px; font-weight: 600;}' +
		'#bio_ep_content span:nth-child(3) {display: block; font-size: 16px;}' +
		'#bio_ep_content span:nth-child(4) {display: block; margin: -5px 0 0 0; font-size: 16px; font-weight: 600;}' +
		'.bio_btn {display: inline-block; margin: 18px 0 0 0; padding: 7px; color: #fff; font-size: 14px; font-weight: 600; background-color: #70bb39; border: 1px solid #47ad0b; cursor: pointer; -webkit-appearance: none; -moz-appearance: none; border-radius: 0; text-decoration: none;}',
	fonts: ['//fonts.googleapis.com/css?family=Titillium+Web:300,400,600'],
	cookieExp: 0
});

Using an image

bioEp.init({
	width: 394,
	height: 298,
	html: '<a href="#YOURURLHERE" title="Claim your discount!"><img src="http://beeker.io/images/posts/2/template2.png" alt="Claim your discount!" /></a>',
	cookieExp: 0
});

Options

All options must be added to the init function as an object.

Name | Type | Default | Description -----|------|---------|------------ width | integer | 400 | The width of the popup. This can be overridden by adding your own CSS for the #bio_ep element. height | integer | 220 | The height of the popup. This can be overridden by adding your own CSS for the #bio_ep element. html | string | blank | The HTML code to be placed within the popup. HTML can be added through this function or on the page itself within a element. css | string | blank | The CSS styles for the popup. CSS can be added through this function or on the page itself. fonts | array | null | An array containing URLs that link to font stylesheets. Google Fonts was the main idea behind this feature. delay | integer| 5 | The time, in seconds, until the popup activates and begins watching for exit intent. If showOnDelay is set to true, this will be the time until the popup shows. showOnDelay | boolean | false | If true, the popup will show after the delay option time. If false, popup will show when a visitor moves their cursor above the document window, showing exit intent. cookieExp | integer | 30 | The number of days to set the cookie for. A cookie is used to track if the popup has already been shown to a specific visitor. If the popup has been shown, it will not show again until the cookie expires. A value of 0 will always show the popup. showOncePerSession | boolean | false | If true, the popup will only show once per browser session. If false and cookieExp is set to 0, the popup will show multiple times in a single browser session. onPopup | function | null | A callback function to be called when the popup is displayed in the browser.

License

MIT license, feel free to use however you wish!

Created by beeker.io