I'm not sure I have come to the right bit of this forum, but here goes.
I have implemented a window.onload function on my website using shadowbox which just simply shows a div with a background image. The onload function works perfectly everytime, but I would like it to just popup once per person viewing the site. The script for the popup is this:
<script type="text/javascript">
Shadowbox.init({
// let's skip the automatic setup because we don't have any
// properly configured link elements on the page
skipSetup: true,
// include the html player because we want to display some html content
players: ["html"]
});
window.onload = function(){
// open a welcome message as soon as the window loads
Shadowbox.open({
content: '<div id="welcome"></div>',
player: "html",
title: "Welcome",
height: 350,
width: 350
});
Hi Sterling, I read your solution and try to apply it but it seems it doesnt' work, I have no more popup... :-(
Here is my code:
Code:
<link rel="stylesheet" type="text/css" href="shadowbox/shadowbox.css">
<script type="text/javascript" src="shadowbox/shadowbox.js"></script>
<script type="text/javascript">
Shadowbox.init({
// let's skip the automatic setup because we don't have any
// properly configured link elements on the page
skipSetup: true,
// include the html player because we want to display some html content
players: ["html"]
});
window.onload = function(){
if( document.cookie && !/(^|\s|;)shownDiv=true(;|$)/.test( document.cookie ))
{
document.cookie = 'shownDiv=true';
// open a welcome message as soon as the window loads
Shadowbox.open({
content: '<div id="welcome-msg">Nous vous remercions pour votre visite et nous vous informons que la boutique sera enrichie de nouveaux produits dans les prochaines semaines. <br />Bonne visite...</div>',
player: "html",
title: "Bienvenue sur la boutique en ligne des Secrets de Lily",
height: 120,
width: 450
});
}
};
</script>
Bookmarks