Last active
September 30, 2022 08:36
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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