open the popup when user clicks on an external link

Hello,

I am wondering if there is a way to open the popup when a visitor clicks on a link which will lead him to an external page.

similarly I’d like to trigger the popup also when closing the page.

thank you in andvance!

Andrea

  • Michelle Shull
    • DEV MAN’s Apprentice

    Hi, Andrea!

    We can do most of this. : )

    I've added a screenshot below of the behavior settings for a new PopUp.

    To trigger when the user attempts to close the page, we're going to trick it just a little, and choose "Appear when the mouse leaves the browser window"

    We can't narrow down the onClick to only work with external links, because it uses CSS selectors to trigger the event. We can trigger it on any link, by using the "a" CSS selector, but that may be overkill. Would that work or do you need something specific only to external links?

    Thanks, and happy Friday!

  • Andrea
    • The Crimson Coder

    Thanx Michelle,

    I thought about that but I made the same consideration about the overkilling of triggering it at any click link.

    unfortunately this is for a client, so I can’t add a specific class to links which leads outside, because he would have to do it for the links added in the future, and I think he won’t be able.

    But now that I am saying it, I am thinking about a jquery or js which checks any “a” tag and if the href parameter is containing an external link it appends the “external-link” class to the “a” tag…

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.