Skip to content

Commit 0e09d43

Browse files
authored
Create script.js
1 parent dfb2962 commit 0e09d43

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
(function() {
2+
$(document).ready(function() {
3+
var count, rotateY, setValueFunc, value, zero;
4+
zero = 0;
5+
rotateY = 180;
6+
value = 0;
7+
count = 0;
8+
setValueFunc = function() {
9+
if (count % 2 === 0) {
10+
return $(".value_front").text(value);
11+
} else {
12+
return $(".value_back").text(value);
13+
}
14+
};
15+
$(".increment").on("mouseenter", function() {
16+
$(".increment").css({
17+
"opacity": "1"
18+
});
19+
return $(".decrement").css({
20+
"opacity": ".2"
21+
});
22+
});
23+
$(".container").on("mouseout", function() {
24+
$(".increment").css({
25+
"opacity": ".2"
26+
});
27+
return $(".decrement").css({
28+
"opacity": ".2"
29+
});
30+
});
31+
$(".decrement").on("mouseenter", function() {
32+
$(".decrement").css({
33+
"opacity": "1"
34+
});
35+
return $(".increment").css({
36+
"opacity": ".2"
37+
});
38+
});
39+
$(".increment").on("mousedown", function() {
40+
count++;
41+
$(".container").css({
42+
"transform": `rotateY(${zero = zero + rotateY}deg)`
43+
});
44+
value++;
45+
return setValueFunc();
46+
});
47+
return $(".decrement").on("mousedown", function() {
48+
count++;
49+
$(".container").css({
50+
"transform": `rotateY(${zero = zero - rotateY}deg)`
51+
});
52+
value--;
53+
return setValueFunc();
54+
});
55+
});
56+
57+
}).call(this);

0 commit comments

Comments
 (0)