summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
895499e)
This is based on
https://github.com/swcarpentry/instructor-training/pull/437/files and
https://github.com/swcarpentry/instructor-training/pull/439/files,
both write by @ErinBecker.
// Handle foldable challenges and solutions (on click and at start).
// Handle foldable challenges and solutions (on click and at start).
-$(".challenge,.discussion,.solution").click(function(event) {
+$(".solution").click(function(event) {
var trigger = $(event.target).has(".fold-unfold").size() > 0
|| $(event.target).filter(".fold-unfold").size() > 0;
if (trigger) {
var trigger = $(event.target).has(".fold-unfold").size() > 0
|| $(event.target).filter(".fold-unfold").size() > 0;
if (trigger) {
event.stopPropagation();
}
});
event.stopPropagation();
}
});
-$(".challenge,.discussion,.solution").each(function() {
+$(".solution").each(function() {
$(">*:not(h2)", this).toggle();
var h2 = $("h2:first", this);
h2.append("<span class='fold-unfold glyphicon glyphicon-collapse-down'></span>");
$(">*:not(h2)", this).toggle();
var h2 = $("h2:first", this);
h2.append("<span class='fold-unfold glyphicon glyphicon-collapse-down'></span>");