1
A
回答
1
你需要一個JavaScript庫,如jQuery - 那麼它很容易指定動畫動作事件。閱讀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 ...
我建議jQuery的,以及(http://jquery.com/),因爲它是非常好用。
下面是一些在心跳中跳動的代碼。
$("#my_checkbox").change(function() {
if ($(this).is(':checked')) {
$("#my_html").hide(); // hide element with id="my_html"
} else {
$("#my_html").show(); // show...
}
});
相關問題
- 1. 與html摺疊表
- 2. Flex可摺疊字段組控件
- 3. 字段在集合上摺疊
- 4. 使用jQuery摺疊個別字段集
- 5. Drupal:禁用可摺疊字段集
- 6. Django管理內聯和摺疊字段
- 7. EPPlus樞軸表 - 摺疊整個字段
- 8. Drupal:使文本字段可摺疊
- 9. 展開/摺疊HTML中的文本 - Javascript
- 10. HTML/CSS中的可摺疊面板
- 11. 摺疊區域中的代碼片段
- 12. 可摺疊邊距HTML/CSS
- 13. 展開/摺疊HTML表格
- 14. AJAX可摺疊面板HTML
- 15. 如何摺疊HTML空格?
- 16. 如何摺疊段落?
- 17. TableView摺疊/展開區段
- 18. 摺疊/取消折疊所有菜單項。 - HTML/JS/CSS/Bootstrap3
- 19. 在JavaScript中展開摺疊菜單HTML
- 20. Aptana摺疊/摺疊方法?
- 21. PyCharm代碼摺疊摺疊
- 22. 使用摺疊的字數
- 23. 字符串上的摺疊
- 24. 錶行在HTML中摺疊,但不是從JQuery腳本中摺疊
- 25. 可摺疊字段集不適用於Drupal中的UNauth用戶?
- 26. Drupal:摺疊編輯內容頁面中的CCK字段?
- 27. 摺疊Scala中
- 28. 如何摺疊/摺疊UITableView的部分?
- 29. 如何摺疊iOS 7中的文字?
- 30. 正確摺疊Elasticsearch中的ASCII字符