forked from jupiterjs/jquerymx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhover.html
More file actions
56 lines (53 loc) · 1.39 KB
/
hover.html
File metadata and controls
56 lines (53 loc) · 1.39 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>hover</title>
<style type='text/css'>
body {font-family: verdana}
.error {border: solid 1px red;}
.error_text { color: red; font-size: 10px;}
td {padding: 3px;}
.hover, .hovers {
border: solid 1px green;
}
.hoverstate {
background-color: yellow;
}
.myhover {
border: solid 1px red;
}
</style>
</head>
<body>
<div id='demo-html'>
<h4>Delegating</h4>
<div class='hover'>hover me</div>
<div class='hover'>hover me</div>
<h4>Bound Directly</h4>
<div class='hovers'>hover me for a second</div>
<div class='hovers'>hover me for a second</div>
</div>
<script type='text/javascript'
src='../../../steal/steal.js?steal[app]=jquery/event/hover&steal[env]=development'>
</script>
<script type='text/javascript' id='demo-source'>
// adds a hover class
var add = function(ev){
$(this).addClass("hoverstate")
},
// removes a hover class
remove = function(ev){
$(this).removeClass("hoverstate")
}
// delegate on hover
$('.hover').live('hoverenter',add)
$('.hover').live('hoverleave', remove)
$('.hovers').bind('hoverinit',function(ev, hovered){
hovered.delay(1000)
})
$('.hovers').bind('hoverenter',add)
$('.hovers').bind('hoverleave', remove)
</script>
</body>
</html>