• asaynisch

    (@asaynisch)


    Hey Curtis,

    first of all, Im very pleased with your work. It does exactly what I want it to do, and I like that there are so many options for fine tuning it.
    Keep up the good work!

    I have only one problem: I want to add a Link to the navbar, and it seems like at this point the way wordpress handles links in the navbar is interrupting with your Plugin.

    What happens is that the pop up shows up correctly but WordPress opens the link anyway.

    I already tried to figure out why, and it seems like wordpress is applying its own onclick events to all <a> elements in the navbar which changes the window.location and are handled right before the events of your Plugin:

    function() {
    if ($(this).attr('target') !== '_blank') {
    window.location = $(this).attr('href');
    } else {
    var win = window.open($(this).attr('href'), '_blank');
    win.focus();
    }
    }

    If you want to take a look by yourself, you can try the “SHOP” Menu-Item in the Navbar of my Website.

    Do you think there is a nice solution to turn off this behavior so that the link will not be opened again until you have agreed to it?

    At the moment I can only think of trying to reset every onclick function before the exit notifier is applied but this is somehow a hacky solution :/

    Thanks in advance!

    • This topic was modified 5 years ago by asaynisch.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Curtis V. Schleich

    (@cvscvstechcom)

    Ugh. Well, I’m already trying to deal with this on the WooCommerce external products plugin. Anything that hijacks the click event is going to be a problem for my plugin.

    And hijacking it back, as you already figured out, is dicey at best. It assumes way too much to not cause as many problems as it solves.

    I’ll keep this site in mind as I work on the WooCommerce thing and see if I can’t come up with a more elegant approach. Is the menu a function of a plugin or the theme?

    Thread Starter asaynisch

    (@asaynisch)

    Thanks for your quick response. I feared that this is Not so easy to solve.

    It’s the normal WordPress Menu which is customizable in the Appearance-Tab, But I’m not Sure if this behaviour is Not because of the theme. I found The mentioned code snippet inline in my Website, so I thought its a native WordPress function.

    The only Plugin I use for the navbar is one which makes it sticky and add Some nice Animations. I already made Sure that this doesn‘t interfere with your Plugin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Link directly opens anyway when in Navbar’ is closed to new replies.