Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stracker-phil/b8ba3cb93ed129ad631b2f9acc1fdf8e to your computer and use it in GitHub Desktop.
Save stracker-phil/b8ba3cb93ed129ad631b2f9acc1fdf8e 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