forked from kbalog/web-programming
-
Notifications
You must be signed in to change notification settings - Fork 1
/
methods2.html
42 lines (42 loc) · 1.03 KB
/
methods2.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Methods example #2</title>
<style>
div {
border: 1px solid grey;
margin: 10px;
background-color: blue;
float: left;
}
.square {
width: 100px;
height: 100px;
}
.red {
background-color: red;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script>
$(document).ready(function () {
$("div").addClass("square");
$("div").mouseenter(function () {
$(this).css("border", "2px double black");
});
$("div").mouseleave(function () {
$(this).css("border", "1px solid grey");
});
$("div").click(function () {
$(this).toggleClass("red");
});
});
</script>
</head>
<body>
<div></div>
<div></div>
<div></div>
</body>
</html>