1
A
答えて
1
あなたは、jQueryのJavaScriptライブラリなど、必要 - イベントにアニメーションのアクションを割り当てることが、その簡単に。 jQueryドキュメントを読んで、他の人が間違いなくここに置くことになるソリューションを学んだり、カットアンドペーストしたりしてください。
これはDjango固有の問題で、javascriptとhtmlではありません。
1
以下のjQueryコードでは、 '+'イメージとヘッダーのイメージを使用しています。例えば+トップテン
私はそれを使ってアコーディオンを作成しました。
$(document).ready(function() {
$("div#hideable div").hide();
// add css to show +/- symbols and labels - no point showing them if they don't work!
$("div#hideable h3 a img").css("display", "inline");
$("div#hideable label").css("display", "inline");
$("div#hideable h3 a").toggle(function() {
$($(this).attr("href")).show();
imgName = $(this).find('img').attr("src").split("-", 1); //grab the image name so that we get the right one
$(this).find('img').attr("src", imgName + "-minus.gif"); //change img, alt and label to match action
$(this).find('img').attr("alt", "-");
var sectionId = $(this).attr("href").substring($(this).attr("href").length - 1);
if (sectionId == 0) {
sectionId = 10;
}
labelName = "#lblSection" + sectionId;
$(labelName).text("click '-' to collapse");
}, function() {
$($(this).attr("href")).hide();
$(this).find('img').attr("src", imgName + "-plus.gif");
$(this).find('img').attr("alt", "+");
var sectionId = $(this).attr("href").substring($(this).attr("href").length - 1);
if (sectionId == 0) {
sectionId = 10;
}
labelName = "#lblSection" + sectionId;
$(labelName).text("click '+' to expand");
});
});
2
トウシュSpacedman ...
それは使用することは非常に簡単だと私も(http://jquery.com/を)jqueryのをお勧めします。
ここでは、ハートビートに埋め込まれたコードを紹介します。
$("#my_checkbox").change(function() {
if ($(this).is(':checked')) {
$("#my_html").hide(); // hide element with id="my_html"
} else {
$("#my_html").show(); // show...
}
});
関連する問題
- 1. solrでの分散フィールドの崩壊
- 2. HTML:崩壊ボタン行為フォームは、フォーム
- 3. 崩壊のフィールドセット
- 4. ブートストラップボタングループの崩壊
- 5. Xamarin - 崩壊テキスト
- 6. 崩壊日は
- 7. 崩壊多数
- 8. アコーディオン崩壊jquery
- 9. ブートストラップ崩壊が
- 10. 崩壊がモーダル
- 11. netbeans崩壊コメントブロック
- 12. マテリアライズボタン崩壊ブレークポイント
- 13. 崩壊ツリービュー
- 14. ブートストラップグリッドシステムが崩壊
- 15. 崩壊3列
- 16. ブートストラップ - ロードパネルの崩壊
- 17. ブートストラップレスポンスナビ崩壊のトラブル
- 18. 関係の崩壊
- 19. 崩壊時のアニメーションジャンプ
- 20. 修正ボディストラップナビゲーションバー崩壊
- 21. ブートストラップ3崩壊他
- 22. boostrap navbar崩壊ブレークポイント
- 23. BootStrap 3.3崩壊ブロックラジオボタン
- 24. 崩壊で崩壊しても動作しません
- 25. ブートストラップ「パネル崩壊」「崩壊」がオンラインで動作しない
- 26. Sharepointのナビゲーションメニューの崩壊
- 27. フレックスボックスのマージンの崩壊
- 28. Twitterのブートストラップ2、崩壊-NAV
- 29. MySQLの崩壊/マージ行
- 30. SQLiteの崩壊とヌル