I currently have a JavaScript function that increments a cookie value after each page visit. On the third visit I would like an iframe FancyBox to open. Below is a snippet of where I am stuck:
<script>
visits = getCookie('nVisits');
if (!visits){visits = 1};
if (visits == 3 ){++visits;
/* WHAT DO I PUT HERE :( */
}
if (visits != 3){++visits;
cookieData = visits;
setCookie('nVisits',cookieData,expDate)
}
</script>
I assume this needs to call a hidden anchor tag or something.
Try
if (visits == 3 ){++visits;
/* WHAT DO I PUT HERE :( */
jQuery.fancybox({
href: "another-site.html",
type: "iframe" // for external pages
});
}
Now, you can set another type
of content like image
, ajax
or html
for instance so you would need to set both, href
and type
API options/values accordingly.