Created
June 27, 2018 04:59
-
-
Save amitguptagwl/336a37701346d0dce1c3e325a77fa594 to your computer and use it in GitHub Desktop.
api.checklist.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Following snippet make the nested tasks collapsible | |
$("ol.task li").each(function(){ | |
var subtasks = $(this).find(".subtasks ol li"); | |
if(subtasks.length !== 0){ | |
$( $( $(this).children()[0] ).children()[0] ).prepend('<span class="expandable">-</span>'); | |
} | |
}); | |
$(".expandable").click(function(e){ | |
var subtasks = $(this).parent().parent().next(); | |
if(subtasks.hasClass("collapsed")){ | |
subtasks.removeClass("collapsed"); | |
subtasks.addClass("expanded"); | |
$(this).text("-"); | |
subtasks.show(500); | |
}else{ | |
subtasks.removeClass("expanded"); | |
subtasks.addClass("collapsed"); | |
$(this).text("+"); | |
subtasks.hide(500); | |
} | |
e.preventDefault(); | |
e.stopPropagation(); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment