Web Analytics Made Easy -
StatCounter Fancybox popup on page load - CodingForum

Announcement

Collapse
No announcement yet.

Fancybox popup on page load

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Fancybox popup on page load

    I have a page that loads a fancybox popup and it works perfectly with the cookie for setting ho many days to show. the problem i have is that i need it to show 1 every 24 hours over a 3 day period. once the 3rd day is over and the user sees the window for the 3rd day i need a cookie set to never show the window again. here is my code as it sits now. I have worked with this for a couple of days on and off and it is above my head for sure.

    any help is appreciated.

    $(function() {
    if ($.cookie('moment_comm')) {
    // it hasn't been 1 day yet
    } else {


    $("#autostart").fancybox({'overlayShow':true,frameWidth:
    840,frameHeight:360}).trigger('click');
    }
    }
    );

    $('#autostart').live('click', function(e) {
    e.preventDefault();
    $.cookie("moment_comm", "true", { path: '/', expires: 1 });

    $.fancybox.close()
    });

  • #2
    revisiting this here i have come up with this which is some what of what i am looking for.

    $(function() {
    if ($.cookie('moment_comm')) {
    $("#autostart").fancybox({'overlayShow':true,frameWidth:
    840,frameHeight:360}).trigger('click');
    }
    }
    );

    $('#autostart').live('click', function(e) {
    e.preventDefault();
    $.cookie("moment_comm1", "true", { path: '/', expires: 365 });

    $.fancybox.close()
    });

    } else if ($.cookie('moment_comm1')) {
    $("#autostart").fancybox({'overlayShow':true,frameWidth:
    840,frameHeight:360}).trigger('click');
    }
    }
    );

    $('#autostart').live('click', function(e) {
    e.preventDefault();
    $.cookie("moment_comm2", "true", { path: '/', expires: 365 });

    $.fancybox.close()
    });
    } else if ($.cookie('moment_comm2')) {

    } else {


    $("#autostart").fancybox({'overlayShow':true,frameWidth:
    840,frameHeight:360}).trigger('click');
    }
    }
    );

    $('#autostart').live('click', function(e) {
    e.preventDefault();
    $.cookie("moment_comm", "true", { path: '/', expires: 365 });

    $.fancybox.close()
    });




    but i get a syntax error at

    } else if ($.cookie('moment_comm1')) {

    Comment

    Working...
    X