jQuery UI Progressbar
今回は、jQuery UIのProgressbarについて書きます。
Progressbarは、進捗状況を表示するバーのようなものです。
このように使います。
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="utf-8"> <title>jQuery ui</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <script src="http://code.jquery.com/jquery-1.10.2.js"></script> <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script> </head> <body> <div id="progressbar" style="width:250px"></div> <script> $(function(){ $('#progressbar').progressbar({ value : 40 }); }); </script> </body> </html>
実行結果
「 style="width:250px"」としているのは、横幅を調節するためです。デフォルトのままだと、画面いっぱいに広がるので・・・
「.progressbar()」とつけると、Progressbarが実装できます。
「value」は、Progressbarの値です。この値を調節すると、バーが動きます。
$('#progressbar').progressbar({ value : 40 });
ちなみに、「value」の値を「false」にするとこうなります。