Project

General

Profile

Bug #2167 » divtest.html

bring-to-front example with div's - Roman Puls, 08/30/2013 09:34 AM

 
1
<html>
2

    
3
<head>
4
<script src="jquery.js" type="text/javascript"></script>
5
<script type="text/javascript">
6

    
7
function totop(id) {
8
  $(id).parent().append($(id));
9
  $(id).append("<small>clicked, and moved to front</small>");
10
}
11

    
12
</script>
13

    
14

    
15
<style type="text/css">
16
#a {
17
    left: 0px;
18
    top: 0px;
19
    background-color: red;
20
    width: 100px;
21
    height: 100px;
22
    position: absolute;
23
    overflow: auto;
24
}
25

    
26
#b {
27
    left: 50px;
28
    top: 50px;
29
    background-color: blue;
30
    width: 100px;
31
    height: 100px;
32
    position: absolute;
33
    overflow: auto;
34
}
35

    
36
#c {
37
    left: 100px;
38
    top: 100px;
39
    background-color: green;
40
    width: 100px;
41
    height: 100px;
42
    position: absolute;
43
    overflow: auto;
44
}
45

    
46

    
47
</style>
48
</head>
49

    
50
<body>
51

    
52
<div id="a">&nbsp;</div>
53
<div id="b">&nbsp;</div>
54
<div id="c">&nbsp;</div>
55

    
56
<script type="text/javascript">
57
$("div").click(function() {
58
  totop($(this));
59
});
60
</script>
61

    
62

    
63
</body>
64
</html>
(1-1/2)