Skip to content

Instantly share code, notes, and snippets.

@divimode-philipp
Last active September 30, 2022 08:36
Show Gist options
  • Save divimode-philipp/d083f8773b45a5ab2c13991f994bb771 to your computer and use it in GitHub Desktop.
Save divimode-philipp/d083f8773b45a5ab2c13991f994bb771 to your computer and use it in GitHub Desktop.
JS snippet for Popups for Divi / Divi Areas Pro to trigger a Popup after the user scrolled down to a certain point
<script>
(function ($) {
// TODO: Adjust the following to lines to your needs:
var popup = 'contact'; // Your Popup ID.
var distance = 500; // Scroll distance [pixel].
$(window).on('scroll.popup_' + popup, function () {
// Check if the user scrolled far enough.
if ($(window).scrollTop() < distance) {
return;
}
// Remove the custom scroll event, so the Popup is
// only displayed once.
$(window).off('.popup_' + popup);
DiviArea.show(popup);
});
})(jQuery);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment