Display Call To Action bar on page load [migrated]
- by dasickle
I am using the following code to load the bar on click but I can't figure our how to load it on page load automatically.
<script>
var autohide;
$('body').prepend('<div id="bn-bar"><b>DON\'T MISS OUT!</b> Only 9 seats remain for the Google Tag Manager training on May 22! <a href="#">Book Your Seat Today!</a><div id="hider"> </div></div>');
$(document).ready(function(){
$("#hider").click(function(){
$("#bn-bar").animate({
top: "-50"
}, "fast","linear", function(){});
})
$("#bn-bar").mouseover(function(){clearTimeout(autohide);});
setTimeout(function(){$("#bn-bar").animate({top: "0"}, "slow","linear", function(){});},2500);
autohide = setTimeout(function(){$("#bn-bar").animate({top: "-30"}, "fast","linear", function(){});},10000);
})
</script>
Basically I am trying to load a the message when user enters my website and I will be inserting it via Google Tag Manager. Below is a page where I found the code:
Creative Tag Manager – Ads, Promotions, and Visitor Messaging -Lunametrics