Skip to content

Instantly share code, notes, and snippets.

@jwdunne
Last active August 29, 2015 14:02
Show Gist options
  • Save jwdunne/56336cf8c15d5aa5161e to your computer and use it in GitHub Desktop.
Save jwdunne/56336cf8c15d5aa5161e to your computer and use it in GitHub Desktop.
<?php if ($_SERVER['REQUEST_URI'] == '/invisible-braces.html' || $_SERVER['REQUEST_URI'] == '/') { ?>
<a href="#june-offer" id="june-offer-link"></a>
<div style="display:none">
<div class="june-invisalign-offer" id="june-offer">
<img src="/images/invisalign2.jpg" alt="">
<h3>Invisalign Open Morning</h3>
<p>Invisalign open morning <strong>Saturday 7th June</strong><br />Book in for free consultation.</p>
</div>
</div>
<script>
function openFancybox() {
setTimeout(function () {
$('#june-offer-link').trigger('click');
}, 500);
};
$(document).ready(function () {
var visited = $.cookie('visited');
if (visited == 'yes') {
return false; // second page load, cookie active
} else {
openFancybox(); // first page load, launch fancybox
}
$.cookie('visited', 'yes', {
expires: 7 // the number of days cookie will be effective
});
$("#june-offer-link").click(function () {
$.fancybox({
type: "inline",
href: $(this).attr('href')
});
return false;
});
});
</script>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment