-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.html
178 lines (163 loc) · 5.18 KB
/
index.html
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi"
/>
<title>Doraemon | Made with Pure CSS & love of Ritwick</title>
<meta
name="title"
content="Doraemon | Made with Pure CSS & love of Ritwick"
/>
<meta name="author" content="Ritwick Dey, ritwickdey@outlook.com" />
<meta
name="description"
content="Doraemon (cartoon character) is designed with only CSS & HTML"
/>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<a title="Open Souce" target="_blank" class="github" href="https://github.com/ritwickdey/doraemon-pure-css">
<img width="100%" height="100%" src="./img/github.png" />
<span>GitHub</span>
</a>
<div class="container">
<div class="doraemon">
<div class="head">
<div class="face">
<div class="eyes">
<div class="eye eye-left">
<div class="eyeball"></div>
</div>
<div class="eye eye-right">
<div class="eyeball"></div>
</div>
</div>
<div class="mouth">
<div class="mouth-top">
<div class="mouth-top-right-round">
<div class="mouth-top-right-round-fixer"></div>
</div>
</div>
<div class="mouth-bottom">
<div class="mouth-bottom-ui">
<div class="tongue-container">
<div class="tongue"></div>
</div>
</div>
</div>
</div>
<div class="nose"></div>
<div class="mustache">
<div class="mustache-hair mustache-left-hair"></div>
<div class="mustache-hair mustache-left-hair"></div>
<div class="mustache-hair mustache-left-hair"></div>
<div class="mustache-hair mustache-right-hair"></div>
<div class="mustache-hair mustache-right-hair"></div>
<div class="mustache-hair mustache-right-hair"></div>
</div>
</div>
</div>
<div class="belt">
<div class="bell-ring">
<div class="bell-ring-strip"></div>
<div class="bell-ring-strip"></div>
</div>
</div>
<div class="body-part">
<div class="left-body-part">
<div class="leg left-leg"></div>
</div>
<div class="right-body-part">
<div class="leg right-leg"></div>
</div>
<div class="left-hand"></div>
<div class="right-hand"></div>
<div class="dress">
<div class="pocket"></div>
</div>
<div class="leg-gap"></div>
</div>
</div>
</div>
<div class="footer">
<a target="_blank" href="https://ritwickdey.github.io"
>Made with pure .CSS { and ❤️ of :
<u>Ritwick</u>
}
</a>
</div>
</body>
<script>
function changeObjScale() {
const objDim = {
height: 530,
width: 460,
};
const doraemonContainer = document.querySelector(".doraemon");
if (!doraemonContainer) {
console.error("doraemon container not found.");
return;
}
function updateScale(scale) {
scale = Math.min(scale, 1);
doraemonContainer.style.setProperty(
"transform",
`scale(${scale}, ${scale})`
);
}
const windowDim = {
width: Math.max(
document.documentElement.clientWidth || 0,
window.innerWidth || 0
),
height: Math.max(
document.documentElement.clientHeight || 0,
window.innerHeight || 0
),
};
if (windowDim.width < objDim.width || windowDim.height < objDim.height) {
if (windowDim.width < objDim.width) {
const ratio = windowDim.width / objDim.width;
objDim.height *= ratio;
objDim.width *= ratio;
updateScale(ratio);
}
// this check is requried.
if (windowDim.height < objDim.height) {
const ratio = windowDim.height / objDim.height;
objDim.height *= ratio;
objDim.width *= ratio;
updateScale(ratio);
}
} else {
updateScale(1);
}
}
function updateAppHeight() {
const doc = document.documentElement;
doc.style.setProperty("--app-height", `${window.innerHeight}px`);
}
function onViewPortChange() {
updateAppHeight();
changeObjScale();
}
window.addEventListener("resize", onViewPortChange);
window.addEventListener("DOMContentLoaded", onViewPortChange);
</script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script
async
src="https://www.googletagmanager.com/gtag/js?id=UA-118443281-2"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "UA-118443281-2");
</script>
</html>