• Resolved jorpdesigns

    (@jorpdesigns)


    Hi,

    I have a popup that has a shortcode button for closing included. I would like for a class to be added to the website body (permanently) after this close button is clicked. Is this possible?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Maria T

    (@mariatogonon)

    Hi @jorpdesigns, this is possible using custom codes only.

    You will need to use the following custom codes below:

    1. Custom JavaScript to add the class on the close of a specific popup. See custom javascript code below:

    jQuery('#pum-123').on('pumAfterClose', function () {
        jQuery('body').addClass('my-custom-class');
    });

    2. Custom Javascript code to detect the popup’s cookie and add the class to the HTML on further page loads. See code below:

    jQuery(document).ready(function () {
        if (pm_cookie('cookie-name')) {
            jQuery('body').addClass('custom-class');
        }
    });

    I hope that helps and if you still assistance help please message us directly at?https://wppopupmaker.com/support/. Thank you.

    Thread Starter jorpdesigns

    (@jorpdesigns)

    Wow, had no idea this was possible. Thanks a lot, really appreciate your help and quick response.

    Quick questions:
    1. #pum-123 refers to the name of my cookie yeah? So incase the name of my set cookie is pum-262, my code will have #pum-262 instead.
    2. cookie-name in my code will be pum-262 instead as well?

    Thanks again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add class to body after closing pop up’ is closed to new replies.