Wednesday 19 February 2014

"Stay on Page or Leave Page" Popup script - v2

"Stay on Page or Leave this Page" Exit Popup



1. Go to blogger dashboard -> Template --> Edit Html.

2. Find for </head> and place the following peace of code just above it.
<script type="text/javascript" src="http://kbeezie.com/jquery13.js"></script>
<script src="http://kbeezie.com/fancybox/jquery.fancybox-1.3.1.pack.js" type="text/javascript"></script>
<link rel="stylesheet" href="http://kbeezie.com/fancybox/jquery.fancybox-1.3.1.css" type="text/css" media="screen"/>
<script type="text/javascript">
function PopIt() {
$("a#trigger").trigger('click');
window.onbeforeunload = UnPopIt;
return "Would you like to join our mailing list for other offers?";
}
function UnPopIt()  { /* nothing to return */ }
$(document).ready(function() {
window.onbeforeunload = PopIt;
$("a#trigger").fancybox({
'hideOnContentClick': false,
'showCloseButton': false
});
$("a[id!=trigger]").click(function(){ window.onbeforeunload = UnPopIt; });
});
</script>

3. 
Find <body> tag and place the following code just below it.
<div style="display: none;">
<a id="trigger" href="#popup">&nbsp;</a>
<div id="popup" style="width: 250px; height: 400px;">
<p>This would be content of popup form</p>
</div>
</div>
Wondering how to customize the content of this popup form!!!?.

Stay on Page Popup form Customization

  • Change 250px with your desired width.
  • Change 400px with your desired height.
  • Replace This would be content of popup form with your form content.

4. Save the Template.

Share This!


No comments:

Post a Comment

Powered By Blogger · Designed By Seo Blogger Templates