Viewing 1 replies (of 1 total)
  • Hello @olympesimon,

    Apologize for the inconvenience!

    Popup blocks the scroll feature and hence it won’t be a possibility. However, if you are a Divi Area Pro user, you can do that only on Fly-In option. Since, I am not sure which version you are using, I am sharing a script for closing a Fly-In popup.

    PS: It will not be working on any other Popup besides Fly-In.

    This page displays a Fly-In (Pro plugin) that can be hidden by either (a) the button inside the Fly-In, or (b) by scrolling down the page by at least 20 pixels.
    JS Code used on this page:

    <script>
    DiviArea.addAction(‘show_area’, function(area) {
    var scrollDistance = 20;
    var origPos;
    var $wnd = jQuery(window);

    // Removes custom event handlers and closes the Area.
    function hide() {
    area.get(‘a[href^=”#”]’).off(‘click’);
    $wnd.off(‘scroll’, hideOnScroll);
    DiviArea.hide(area);
    return true;
    }

    // Close Area when a anchor-link is clicked.
    area.get(‘a[href^=”#”]’).on(‘click’, hide);

    // Close Area on scroll-down (min 20 pixel).
    function hideOnScroll() {
    var currPos = $wnd.scrollTop();
    if (isNaN(origPos) || currPos < origPos) {
    origPos = currPos;
    } else {
    var distance = currPos – origPos;
    if (distance > scrollDistance) {
    hide();
    }
    }
    }
    $wnd.on(‘scroll’, hideOnScroll);
    });
    </script>

    Please do get back to me, in-case of any query.

    Regards,
    Syed

Viewing 1 replies (of 1 total)
  • The topic ‘Close on scroll’ is closed to new replies.