-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmouse.html
More file actions
166 lines (159 loc) · 3.94 KB
/
mouse.html
File metadata and controls
166 lines (159 loc) · 3.94 KB
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
<html>
<head>
<meta charset='utf-8'>
<title>mouse</title>
<link rel="stylesheet" type="text/css" href="style/bootstrap.css">
<style type="text/css">
#main{
margin-top: 100px;
width: 1000px;
height: 500px;
border:1px solid #000000;
margin-left: auto;
margin-right: auto;
cursor: url(image/2248eae7738bd0f954.png);
}
.top{
width: 1000px;
height: 40px;
line-height: 40px;
}
.title{
height: 40px;
line-height: 40px;
text-align: center;
font-size: 30px;
font-weight: bold;
color: red;
}
.count,.score,.get,.lose{
width: 100px;
height: 40px;
line-height: 40px;
float: right;
font-size: 15px;
font-weight: bold;
color: blue;
}
.div_box{
position: relative;
float: left;
margin: 10px 40px;
width: 100px;
height: 100px;
border: 1px solid black;
border-radius: 50px;
}
.div{
width: 100px;
height: 100px;
background-color: #6495ED;
background-image: url(image/D1-6.png);
background-size: 100px 100px;
border-radius: 50px;
}
.image{
width: 1000px;
margin: 5px auto;
}
.introduce{
width: 1000px;
margin: 5px auto;
}
.introduce p{
text-align: center;
font-size: 20px;
color: red;
font-weight: bold;
}
</style>
</head>
<body>
<div id="main">
<div class="top">
<div class="title">打D叔</div>
</div>
</div>
<div class="image">
<div class="score"></div>
<div class="count"></div>
<div class="lose"></div>
<div class="get"></div>
<button class="btn btn-primary">插入图片</button>
<input id="imageurl" type="url" placeholder="这里输入图片URL" style="height: 30px;">
</div>
<div class="introduce"><p>游戏说明:打到一个得两分,漏掉一个减一分。</br>你可以上传一张图片到<a target="_blank" href="http://jietu.xxx">jietu.xxx</a>上,然后把图片连接地址复制到输入框中点击插入图片</p>
</div>
<script type="text/template" id="div_template">
<div class="div"></div>
</script>
<script type="text/javascript" src="js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="js/underscore.js"></script>
<script type="text/javascript" src="js/backbone-min.js"></script>
<script type="text/javascript" src="js/jquery.jrumble.1.3.js"></script>
<script type="text/javascript">
var score = 0;
var count = 60;
var get = 0;
var lose = 0;
var hitView = Backbone.View.extend({
className : "div_box",
TO : '',
template : $('#div_template').html(),
events : {
"click .div" : "shake"
},
initialize : function(){
_.bindAll(this,"hit","appear");
$("#main").append(this.$el.html(this.template));
this.hit();
},
shake : function(){
this.$el.find(".div").trigger('startRumble');
setTimeout(this.hit,200);
score+=2;
get++;
},
hit : function(){
this.$el.find(".div").trigger('stopRumble');
clearTimeout(this.TO);
var time = Math.random()*5000+1000;
//setTimeout(function(){this.$el.find(".div").hide()},1000);
this.$el.find(".div").hide();
setTimeout(this.appear,time);
},
appear : function(){
this.$el.find(".div").show();
this.TO = setTimeout(this.hit,2000);
score--;
lose++;
},
});
for(i=0;i<10;i++){
new hitView();
}
$(".div").jrumble({
x:4,
y:4,
rotation: 4
});
setInterval(function(){
$(".count").html("倒计时:"+count+"秒");
$(".get").html("get:"+get);
$(".lose").html("lose:"+lose);
$(".score").html("得分:"+score);
if(count==0){
alert("你最终得到了:"+score+"分!");
location.reload();
}
count--;
},1000);
$("button").click(function(){
var url = $('#imageurl').val();
if(!url) return;
$(".div").css({ "background-image" : "url("+url+")"});
});
//$(".div").hover(function(){$(this).trigger("startRumble");},function(){$(this).trigger("stopRumble");});
</script>
</body>
</html>