Showing posts with label jQuery UI. Show all posts
Showing posts with label jQuery UI. Show all posts

Saturday, September 17, 2011

Define callback functions

It's a example show how to define callback function; for example, open, close.



Define callback functions



<!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 = {

open: function() {
alert("callback function - open");
},

close: function() {
alert("callback function - close");
},

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>

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>

Tuesday, September 13, 2011

Add buttons in jQuery UI dialog

example:
buttons in 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 = {
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>



Set linkable title on jQuery UI dialog

example:
linkable title on 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 Options = {
title: "<a href='http://icancode-4-web.blogspot.com/'>i can code! for Web.</a>"
};

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



Monday, September 12, 2011

Example of jQuery UI - Dialog

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" title="My Dialog">
Test Dialog of jQuery UI
</div>
<script>
(function($){
$("#myDialog").dialog();
})(jQuery);
</script>
</body>
</html>