Question

How can I go about actioning a FancyBox popup that notifies new users of a quick sign-up button (or whatever is chosen) like on Digg.com ... and as with Digg just one time. I really have no experience with cookies but already have FancyBox running in other parts of the website, so the basis is already there. I require the popup to appear on page load. Any pointers very happily received!

Was it helpful?

Solution

My eventual solution uses the Reveal Modal plugin (click here) to trigger inline to 'fire' on page load using the modified following code for the popup to be displayed only once every three days. Remember also to load jquery.cookie.js and then add the following code:

<script type="text/javascript">
jQuery(document).ready(function(){
   if (jQuery.cookie('test_status') != '1') {
     jQuery('#myModal').reveal()
        jQuery('#myModal').trigger('click');
        jQuery.cookie('test_status', '1', { expires: 3}); }
   });
</script>

Using something other than FancyBox was the answer to the original question as it seemed there was a conflict somewhere, so using Reveal made the two functions completely separate. I should also note that the .css contents from the Reveal download were added to our site's stylesheet.

Hopefully that will help someone else out.

OTHER TIPS

You can find a code example here https://stackoverflow.com/a/8305703/1055987 including the link to the jQuery Cookie plugin.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top