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

stick-to-me

v2.0.0

Published

Exit intent popups

Downloads

22

Readme

🦉The "Stick to me" plugin allows you to create exit-popups on your web page, so you can capture visitors just as they are about to leave. It is now fully compatible with modern JavaScript frameworks and libraries, with no jQuery dependency.

How it Works

Stick-to-me tracks the user mouse movement and detects when to trigger the popup. See it in action on gif below.


Table of Contents

Installation

You can install this package through npm

npm install stick-to-me

-- OR --

Just download the zip file and extract on your assets folder.

Usage

1 - Include CSS and JS files on your project

	<!-- stick-to-me -->
	<link rel="stylesheet" type="text/css" href="path/to/stick-to-me.css">
	<script src="path/to/stick-to-me.js"></script>

2 - Write your popup markup

<div id="stickLayer" style="display:none;" class="stick_popup">
	<div class="stick_close">&times;</div>
	<div class="stick_content">
	    <h1>Hello! I got your attention!</h1>
	</div>
</div>

3 - Initialize the plugin and specify the id of your popup

<script>
	document.addEventListener('DOMContentLoaded', function() {
		const stickToMeInstance = stickToMe({
			layer: '#stickLayer'			
		});

		// Add event listener to close button
		document.querySelector('.stick_close').addEventListener('click', stickToMeInstance.close);
	});
</script>

Customisation

Stick to me allows a few customisations. See options below.

| Property | Description | default | |---|---|---| | layer | Selector of your popup html | empty | | fadespeed |Controls the speed of the fade animation | 400 | | trigger | Where detection of exit intent takes place | top | | delay | Delay before showing popup when exit intent is detected | 0 | | interval | Interval between popups | 0 | | maxamount | Maximum times the popup will be triggered | 0 = unlimited | | cookie | Set cookie to prevent opening again on the same browser | false | | cookieExpiration | Define the cookie expiration in seconds (if set cookie to true) | none (will save the cookie as session cookie) | bgclickclose | Clicking on background closes the popup | true | | escclose | pressing ESC closes the popup | true | | onleave | function to be called when popup closes | empty fn | | debug | Enable Debug mode to display console messages | false |

Debug Mode

The Stick to Me plugin includes a Debug mode that provides helpful console messages to understand the plugin's behavior. When Debug mode is enabled, you will see messages related to tracking movement, detecting intent, indicating direction, and firing the popup.

To enable Debug mode, set the debug option to true when initializing the plugin:

const stickToMeInstance = stickToMe({
    layer: '#stickLayer',
    debug: true
});

When Debug mode is ON, console messages will be displayed to help you understand what is happening. When Debug mode is OFF, no console messages will be shown.

Support

If you need help, reach out to me at one of the following places!

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Postcardware

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Rua Dias de Toledo, 91, Vila da saúde, São Paulo / SP - Brazil.

Donations

License

License

Credits

  • GIF Landing Page template - https://onepagelove.com/evolo