-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
146 lines (131 loc) · 4.05 KB
/
script.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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
$(document).ready(function(){
$('.checkmark').hide();
$('.list-one .list-border:first-child').addClass('highlight');
$('.image:first-child').addClass('d-highlight grow');
$('.image:first-child .l-group').addClass('dark');
function mouseOver() {
$(this).find('.balloon').addClass('balloon-active');
}
function mouseOut() {
$(this).find('.balloon').removeClass('balloon-active');
}
$('.list-border').hover(mouseOver, mouseOut);
// Ingredient List Check-off
$('.list-one .list-border:first-child').click(function() {
$(this).find('.checkmark').show();
$(this).find('.balloon').css('opacity', 1);
$(this).removeClass('highlight')
.css('pointer-events', 'none');
$(this).next().addClass('highlight');
});
$('.list-one .list-border:not(:first-child)').click(function(){
if ($(this).prev().find('.checkmark').css('display') != 'none') {
$(this).find('.checkmark').show();
$(this).find('.balloon').css('opacity', 1);
$(this).removeClass('highlight')
.css('pointer-events', 'none');
$(this).next().addClass('highlight');
}
if ($('.list-one .list-border:last-child').find('.checkmark').css('display') != 'none') {
$('.list-two .list-border:first-child').addClass('highlight');
$(this).css('pointer-events', 'none');
}
});
$('.list-two .list-border:first-child').click(function(){
if ($('.list-one .list-border:last-child').find('.checkmark').css('display') != 'none') {
$(this).find('.checkmark').show();
$(this).find('.balloon').css('opacity', 1);
$(this).removeClass('highlight')
.css('pointer-events', 'none');
$(this).next().addClass('highlight');
}
});
$('.list-two .list-border:not(:first-child)').click(function(){
if ($(this).prev().find('.checkmark').css('display') != 'none') {
$(this).find('.checkmark').show();
$(this).find('.balloon').css('opacity', 1);
$(this).removeClass('highlight')
.css('pointer-events', 'none');
$(this).next().addClass('highlight');
}
});
// Directions Check Off
$('.image:first-child').click(function(){
$(this)
.find('p')
.hide()
.end()
.find('.drawing span')
.addClass('big-checkmark')
.end()
.find('.drawing')
.css('opacity', 1)
.end()
.find('.l-group')
.css('background-color', 'rgba(0,0,0,0.4)')
.removeClass('dark')
.end()
.removeClass('d-highlight grow')
.css('pointer-events', 'none')
.next()
.addClass('d-highlight grow')
.end()
.next()
.find('.l-group')
.addClass('dark');
});
$('.image').click(function(){
if ($(this).prev().find('p').css('display') == 'none') {
$(this)
.find('p')
.hide()
.end()
.find('.drawing span')
.addClass('big-checkmark')
.end()
.find('.drawing')
.css('opacity', 1)
.end()
.find('.l-group')
.css('background-color', 'rgba(0,0,0,0.4)')
.removeClass('dark')
.end()
.removeClass('d-highlight grow')
.css('pointer-events', 'none')
.next()
.addClass('d-highlight grow')
.end()
.next()
.find('.l-group')
.addClass('dark');
}
});
// Toggle Images Visibility
$('#image-checkbox').click(function(){
$('.image img').toggle(this.checked);
});
// Reset Ingredients Checklist
$('#i-reset').click(function(){
$('.checkmark').hide();
$('.list-one .list-border').removeClass('highlight')
.css('pointer-events', 'auto');
$('.list-one .list-border:first-child').addClass('highlight');
$('.list-two .list-border').removeClass('highlight')
.css('pointer-events', 'auto');
$('.balloon').css('opacity', 0.5);
$('.list-border').hover(mouseOver, mouseOut);
});
// Reset Directions Checklist
// does not reset opacity of balloon on hover - fix later
$('#d-reset').click(function(){
$('.image p').show();
$('.drawing span').removeClass('big-checkmark');
$('.drawing').css('opacity', 0.8);
$('.l-group').css('background-color', '');
$('.image').removeClass('d-highlight grow')
.css('pointer-events', 'auto');;
$('.image .l-group').removeClass('dark');
$('.image:first-child').addClass('d-highlight grow');
$('.image:first-child .l-group').addClass('dark');
});
});