Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 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
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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')) {


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •