modal window

Modal window opens immediately and does not close on its own.
i would like the modal window to open only after 10 seconds and and it should not be resized.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Chat</title>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.5.2.js'></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/ui-lightness/jquery-ui.css">
<script type='text/javascript'>
$(window).load(function(){
$("#dialog-message").dialog({
    modal: true,
    position: ['center', 'top'],
    width: 250,
   	buttons: {
        "Chat": function() {
            $(this).dialog("close");          
            setTimeout(function() {
               foo.dialog('close').focus();
            }, 100000);
            
        },
      }  
                                               
});
});
</script>
</head>
<body>
<p>Shopping</p>
<div id="dialog-message" title="Chat"> 
  <div>
    Need help, please chat with our customer service.
  </div>
</div>
</body>
</html>

Open in new window

codelevelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
Hi,

the following should work:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Chat</title>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.5.2.js'></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/ui-lightness/jquery-ui.css">
<script type='text/javascript'>
$(window).load(function(){
	setTimeout(LoadModalDialog, 10000);
});

function LoadModalDialog() {
	$("#dialog-message").dialog({
		modal: true,
		position: ['center', 'top'],
		width: 250,
		buttons: {
			"Chat": function() {
				$(this).dialog("close");          
			}
		}  
	});    
}
</script>
</head>
<body>
<p>Shopping</p>
<div id="dialog-message" title="Chat" style="display: none"> 
  <div>
    Need help, please chat with our customer service.
  </div>
</div>
</body>
</html>

Open in new window


Live sample:
http://jsfiddle.net/EE_RainerJ/rmzx5ujk/

HTH
Rainer
1
codelevelAuthor Commented:
rainer,

it works.
but can you please address this small item "it should not be resized". currently the modal can be resized.
0
Rainer JeschorCommented:
Hi,

sorry, I did not see that.
It is just an additional option in the dialog configuration:
resizable: false

Open in new window


There that part should look like:
$("#dialog-message").dialog({
		modal: true,
		position: ['center', 'top'],
		width: 250,
		resizable: false,
		buttons: {
			"Chat": function() {
				$(this).dialog("close");          
			}
		}  
	});    

Open in new window


HTH
Rainer
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.