Saturday, September 17, 2011

Set dimensions of jQuery UI dialog

To set dimensions of jQuery UI dialog, we can use options of width, height, minWidth, minHeight, maxWidth, maxHeight.



example:



Set dimensions of jQuery UI dialog



<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script src="http://code.jquery.com/ui/1.8.16/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.16/themes/smoothness/jquery-ui.css">
<title>jQuery UI Dialog</title>
</head>
<body>
i can code! for Web.
<div id="myDialog">
Test Dialog of jQuery UI
</div>
<script>
(function($){

var functionOK = function(){
alert("OK");
},
functionCancel = function(){
alert("Cancel");
},
Options = {

width: 300,
height: 200,
minWidth: 200,
minHeight: 200,
maxWidth: 600,
maxHeight: 250,

title: "<a href='http://icancode-4-web.blogspot.com/'>i can code! for Web.</a>",
buttons:{
"OK": functionOK,
"Cancel": functionCancel
}
};

$("#myDialog").dialog(Options);
})(jQuery);
</script>
</body>
</html>

No comments:

Post a Comment