Last active
August 5, 2019 11:30
-
-
Save nikhilatjumpcut/e59e442092e1e310d9fa31a908a7bb6e to your computer and use it in GitHub Desktop.
vaCTADelayScript.js
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
(function vaCTADelayScript() { | |
var funnelAccess = window.__TSUNAMI__.funnelAccess; | |
var currentStep = funnelAccess.find(function(access) { | |
if (access.isCurrentStep) { | |
return true; | |
} | |
return false; | |
}); | |
$ctaBlocks = $("[data-title='cta-block']"); | |
$ctaSection = $('#section--37511'); | |
$ctaSection.attr('style', $ctaSection.attr('style') + 'display:none;'); | |
$ctaBlocks.each(function() { | |
$(this).attr('style', $(this).attr('style') + 'display:none;'); | |
}); | |
var LOCAL_STORAGE_KEY = 'show_va_cta'; | |
var CTA_TIMEOUT = 33 * 60 * 1000; | |
var ctaBlocks = $('[data-title=cta-block], #section--37511'); | |
var ctaHeader = $('#section--33797'); | |
var shouldShowCTA = localStorage.getItem(LOCAL_STORAGE_KEY) === 'true'; | |
if (shouldShowCTA) { | |
ctaBlocks.show(); | |
return; | |
} | |
ctaHeader.css('min-height', '100vh'); | |
localStorage.setItem(LOCAL_STORAGE_KEY, 'true'); | |
setTimeout(function() { | |
ctaBlocks.fadeIn(); | |
ctaHeader.css('min-height', 'auto'); | |
}, CTA_TIMEOUT); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment