forked from Khan/khan-exercises
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhints.js
More file actions
69 lines (58 loc) · 1.71 KB
/
hints.js
File metadata and controls
69 lines (58 loc) · 1.71 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
$(Khan).bind("checkAnswer", function() {
if (!$(".hint-box").data("free")) {
$(".hint-box")
.data("free", true)
.css("position", "relative")
.animate({top: -10}, 250)
.find(".info-box-header")
.slideUp(250)
.end()
.find("#hint")
.switchClass("orange", "green", 1 /* duration */, function() {
$(this)
.data("buttonText", Khan.showSolutionButtonText)
.val(Khan.showSolutionButtonText);
});
}
});
$(Khan).bind("newProblem", function() {
// Restore the hint button
$("#hint")
.removeClass("green")
.addClass("orange")
.val("I'd like a hint")
.data("buttonText", false)
.stop(true /* clear */, true /* jump */)
.appendTo("#get-hint-button-container");
$(".hint-box")
.data("free", false)
.css("top", "0")
.find(".info-box-header")
.show();
var examples = $("#examples");
if (examples.length && $.prototype.qtip != null) {
// Tooltip-ify the example answer formats
$("#examples-show").qtip({
content: {
text: examples.remove(),
prerender: true
},
style: {
classes: "ui-tooltip-light leaf-tooltip"
},
position: {
my: "bottom center",
at: "top center"
},
show: {
delay: 200,
effect: {
length: 0
}
},
hide: {
delay: 0
}
});
}
});