Twitter Bootstrap2.3.1でボタンの状態遷移を設定します。
【準備】
1.「Twitter Bootstrap2.3.1の使用方法」の手順の通り、Twitter Bootstrapを配置しておきます。
【手順1】
1.HTMLファイル「index.html」(任意)を作成。
2.「index.html」を以下の様に入力。
<!DOCTYPE html>
<html>
<head>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
<a href="#" id="button1" class="btn" data-loading-text="読込中...">aタグ ボタン</a>
<button type="button" id="button2" class="btn" data-loading-text="読込中...">buttonタグ ボタン</button>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script>
$('#button1').click(function () {
var btn = $(this)
btn.button('loading')
setTimeout(function () {
btn.button('reset')
}, 3000)
})
$('#button2').click(function () {
var btn = $(this)
btn.button('loading')
setTimeout(function () {
btn.button('reset')
}, 3000)
})
</script>
</body>
</html>
【手順2】
1.ブラウザで「index.html」を開き、以下の様に表示されれば成功です。
以上です。




0 件のコメント:
コメントを投稿
注: コメントを投稿できるのは、このブログのメンバーだけです。