/
outliner.js
43 lines (40 loc) · 1.13 KB
/
outliner.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$("h1").on("click", function () {
$(this).nextUntil("h1").toggle();
$(this).toggleClass("more");
});
$("h2").on("click", function () {
$(this).nextUntil("h1, h2").toggle();
$(this).toggleClass("more");
});
$("h3").on("click", function () {
$(this).nextUntil("h1, h2, h3").toggle();
$(this).toggleClass("more");
});
$("h4").on("click", function () {
$(this).nextUntil("h1, h2, h3, h4").toggle();
$(this).toggleClass("more");
});
$("h5").on("click", function () {
$(this).nextUntil("h1, h2, h3, h4, h5").toggle();
$(this).toggleClass("more");
});
$("h6").on("click", function () {
$(this).nextUntil("h1, h2, h3, h4, h5, h6").toggle();
$(this).toggleClass("more");
});
$("li").hover(function (e) {
e.stopPropagation();
if ($(this).children("ul, ol").length > 0) {
$(this).css("cursor", "pointer");
}
});
$("h1, h2, h3, h4, h5, h6").hover(function () {
$(this).css("cursor", "pointer");
});
$("li").click(function(e) {
e.stopPropagation();
if ($(this).children("ul, ol").length > 0) {
$(this).toggleClass("more");
$(this).children("ul, ol").toggle();
}
});