-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patht2.html
140 lines (134 loc) · 3.03 KB
/
t2.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
<!DOCTYPE html>
<html>
<head>
<style>
/** Basic style **/
*, *:before, *:after {
margin:0;
padding:0;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
}
body {background:#2f323c;}
html, body {
width:100%;
height:100%;
}
#lamp {
position:relative;
width:100vw;
height:100vh;
overflow:hidden;
}
/** Style for switch button **/
input[name="switch"], input[name="switch"] + label {
position:absolute;
bottom:3rem;
width:4rem;
height:4rem;
}
input[name="switch"] + label {right:3rem;}
input[name="switch"] {
opacity:0;
z-index:9;
cursor:pointer;
}
input[value="on"] {
right:3rem;
opacity: 1;
}
input[value="off"] {
right:-4rem;
opacity: 0.3;
}
input[value="on"]:checked {
right:-4rem;
}
input[value="on"]:checked + input[value="off"] {
right:3rem;
}
/** Style for light **/
.lamp {
position:relative;
margin:0 auto;
width:.7rem;
height:10rem;
background-image:linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)),
linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)),
linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7));
background-repeat:no-repeat;
background-size:.15rem 8rem, .4rem .8rem, .7rem 2rem;
background-position:50% 0, .19rem 8rem, 0 8.8rem;
}
.lamp:before, .lamp:after {
content:'';
position:absolute;
}
.lamp:before {
left:-1.65rem;
bottom:-4rem;
width:4rem;
height:4rem;
border-radius:50%;
background:rgba(255,255,255,0.03);
box-shadow:inset 2px -2px 10px rgba(255,255,255,0.07);
transition:all .15s;
}
.gonna-give-light,
.gonna-give-light:before{
position:absolute;
}
.gonna-give-light {
top:10.05rem;
left:.25rem;
width:0;
height:1.5rem;
border-right:.2rem solid rgba(255,255,255,0.05);
}
.gonna-give-light:before {
content:'';
top:1.5rem;
left:-.35rem;
width:.9rem;
height:.9rem;
border-radius:50%;
border:.2rem solid rgba(255,255,255,0.05);
box-shadow:0px 0px 50px rgba(255,255,255,0);
}
input[value="on"]:checked ~ .lamp:before {
background:rgba(255,255,255,1);
box-shadow:0px 2px 10px rgba(255,255,255,0.8),
0px 5px 50px rgba(255,255,255,0.8),
0px 8px 80px rgba(255,255,255,0.6),
0px 8px 120px rgba(255,255,255,0.6);
}
.pointer {cursor: pointer;}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
</head>
<body>
<div ng-app="myApp" ng-init="mySwitch=true" ng-controller="myCtrl">
<div id="lamp">
<input type="radio" name="switch" value="on" ng-model="switch_btn"/>
<input type="radio" name="switch" value="off" checked="checked" ng-model="switch_btn"/>
<div class="lamp" ng-mouseover="lampover()" ng-mouseleave="lampleave()" class="pointer">
<div class="gonna-give-light"></div>
</div>
</div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope,$interval) {
$scope.lampover=function(){
//alert('hahaha');
$scope.switch_btn='on';
}
$scope.lampleave=function(){
//alert('huhuhu');
$scope.switch_btn='off';
}
});
</script>
</body>
</html>