Created
December 27, 2016 04:45
-
-
Save RobertCam/ce75e8fcfa1dcd7157c16c79d3719ed9 to your computer and use it in GitHub Desktop.
Trigger a lightbox based on certain URL parameters
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 getURLParameter(name) { | |
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null | |
} | |
var button = $('#lp-pom-button-309'); // Add ID of lightbox button | |
var email = getURLParameter('email'); // Look for this parameter to trigger the lightbox | |
var first_name = getURLParameter('first_name'); // Look for this parameter to trigger the lightbox | |
if (email || first_name) { | |
setTimeout(function () { | |
$(button)[0].click(); // add the ID of your lightbox button | |
}, 100); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment