Skip to content

Instantly share code, notes, and snippets.

@RobertCam
Last active November 2, 2017 17:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobertCam/7bebd9447c560fe3f9e9da9f10b63815 to your computer and use it in GitHub Desktop.
Save RobertCam/7bebd9447c560fe3f9e9da9f10b63815 to your computer and use it in GitHub Desktop.
trigger an Unbounce lightbox on scroll
<script>
/*
Unbounce Community :: Tips & Scripts :: Open Lightbox on Scroll
TS:0002-04-085
***********************
Do not remove this section. It helps our team track useage of external workarounds.
*/
(function() {
// lightbox button ID
var btn = $("#lp-pom-button-31");
// amount of scroll before opening lightbox
var scroll = 474;
var i = true;
$(window).scroll(function () {
if ($(this).scrollTop() > scroll && i == true) {
$(btn)[0].click();
i = false;
}
});
})();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment