This repository has been archived by the owner on Sep 10, 2019. It is now read-only.
forked from magdapaluch/CookingLearning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
77 lines (53 loc) · 2.13 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
// INDEX.HTML
$('.tabMain').on('click', activeContent);
function activeContent() {
// TAB CHANGE
$('.tabMain').removeClass("activetab");
$(this).addClass('activetab');
// CONTENT CHANGE
$('.category').removeClass('activeCategory');
if ($(this).hasClass('breakfast')) {
$('.contentMainBreakfast').addClass('activeCategory');
} else if ($(this).hasClass('dinner')) {
$('.contentMainDinner').addClass('activeCategory');
} else {
$('.contentMainSnacks').addClass('activeCategory');
}
}
// RECIPE.HTML
$('.feature').on('click', showDescription);
function showDescription() {
$('.shoplisted').removeClass('activeFeature');
$('.scaled').removeClass('activeFeature');
$('.notScaled').removeClass('inactiveFeature');
$('.descriptionFeature').removeClass('descriptionFeatureActive');
$('.priced').addClass('inactiveFeature');
$('.caloried').addClass('inactiveFeature');
if ($(this).hasClass('largerFeature')) {
$('.feature').removeClass('largerFeature');
$('.feature').removeClass('smallerFeature');
return 0;
} else {
$('.feature').removeClass('largerFeature');
$('.feature').addClass('smallerFeature');
$(this).removeClass('smallerFeature');
$(this).addClass('largerFeature');
}
if ($(this).hasClass('shoplist')) {
$('.shoplist .descriptionFeature').addClass('descriptionFeatureActive');
$('.shoplisted').addClass('activeFeature');
}
if ($(this).hasClass('scale')) {
$('.scale .descriptionFeature').addClass('descriptionFeatureActive');
$('.scaled').addClass('activeFeature');
$('.notScaled').addClass('inactiveFeature');
}
if ($(this).hasClass('prices')) {
$('.prices .descriptionFeature').addClass('descriptionFeatureActive');
$('.priced').removeClass('inactiveFeature');
}
if ($(this).hasClass('calories')) {
$('.calories .descriptionFeature').addClass('descriptionFeatureActive');
$('.caloried').removeClass('inactiveFeature');
}
}