How many times do we go to tighten a add-on and notice a modal window seeking we to stay? This seems hackneyed today and it’s finished for one reason: it works!
You can build a identical outcome regulating a Glio.js library. It’s a giveaway open-source JS book to detect when a user’s rodent cursor is getting tighten to a edge or when it leaves a browser window.
This can be used to try keeping visitors on your site. But, it can also be used to create energetic effects if a user’s rodent goes distant to one side of a screen.
You’ll find a lot of these exit intent scripts all over a web and many of them are tough to customize. But, that’s what creates Glio.js so great.
It’s a absolute library that gives we control over what we do with a screen. If your user’s rodent leaves a browser we can display a modal, or change a credentials color, or do positively nothing.
It also comes with built-in prohibited spots that we can check whenever a user’s rodent gets tighten to any of a 4 corners of a screen. You can also define a callback method and how tighten a cursor should get before using anything.
With a book in your page, we only add this one line of code (customized with your options):
glio.init( [ direction, callback ] );
direction choice can be any dilemma (e.g. “top-left”) or “top”, representing a tip of a screen. Your callback duty is whatever JS formula we wish to run when a user’s rodent gets too close. Other choice lets we conclude a distance from a instruction point, we can find a associated info on GitHub.
So, if you’re looking for a elementary book to detect exit intent Glio is a must-have resource.
Read Also: Build Modals Using Pure CSS With CSS Modal