Last active
November 2, 2017 17:19
-
-
Save RobertCam/7bebd9447c560fe3f9e9da9f10b63815 to your computer and use it in GitHub Desktop.
trigger an Unbounce lightbox on scroll
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> | |
/* | |
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