Here is working example that shows a dialog if the "modal_shown" cookie is not present. Once the modal is shown, the cookie is added so that it won't show up again for 3 days.
Demo: http://jsfiddle.net/3M9Wq/
You'll need to include these libraries/stylesheets: jQuery, jQuery UI, jQuery Cookie plugin, a jQuery UI theme CSS.
HTML:
<div id="dialog">The dialog</div>
jQuery:
$(document).ready(function() {
// Initialize the dialog (initially hidden)
$('#dialog').dialog({autoOpen: false});
// Check for the "modal_shown" cookie. If not found, show the dialog and add the cookie
if ($.cookie('modal_shown') == null) {
$.cookie('modal_shown', 'yes', { expires: 3, path: '/' });
$('#dialog').dialog("open");
}
});
Alternate jQuery that clicks a button instead of directly opening the dialog:
$(document).ready(function() {
// Check for the "modal_shown" cookie. If not found, click the button and add the cookie
if ($.cookie('modal_shown') == null) {
$.cookie('modal_shown', 'yes', { expires: 3, path: '/' });
$('#modal11').click();
}
});