3.Buttonのサンプルスクリプト
いい感じのボタン表示が簡単にできてしまいます。
<html lang="ja">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
$(function() {$("a").button();});
</script>
</head>
<body>
<a href="#">An anchor</a>
</body>
</html>
→マウスオーバーしたときの表示の切替を勝手にしてくれます。
4つめはDatepicker。
4.Datepickerのサンプルスクリプト
日付を入力するフォームなんかでは定番ですね。
<html lang="ja">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>$(function(){$("#datepicker").datepicker();});</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker" /></p>
</body>
</html>
→フォームをクリックするとカレンダーが表示され、
日付を選択もしくは枠外をクリックするとカレンダーが閉じます。
5つめはダイアローグボックス。
5.Dialogのサンプルスクリプト
応用すると確認画面や登録画面のモーダル表示に使えますね。
<html lang="ja">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
$(function(){$("#dialog").dialog({width:500});});
</script>
</head>
<body>
<div id="dialog" title="ここをドラッグ">
<p>ドラッグとサイズ変更ができます。右上のX印で閉じます。</p>
</div>
</body>
</html>
→ダイアログボックスが表示されればOKです。
本日ラスト、6つめはメニューです。