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字符