Project

General

Profile

Bug #2167 » divtest.html

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

 
<html>

<head>
<script src="jquery.js" type="text/javascript"></script>
<script type="text/javascript">

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

</script>


<style type="text/css">
#a {
left: 0px;
top: 0px;
background-color: red;
width: 100px;
height: 100px;
position: absolute;
overflow: auto;
}

#b {
left: 50px;
top: 50px;
background-color: blue;
width: 100px;
height: 100px;
position: absolute;
overflow: auto;
}

#c {
left: 100px;
top: 100px;
background-color: green;
width: 100px;
height: 100px;
position: absolute;
overflow: auto;
}


</style>
</head>

<body>

<div id="a">&nbsp;</div>
<div id="b">&nbsp;</div>
<div id="c">&nbsp;</div>

<script type="text/javascript">
$("div").click(function() {
totop($(this));
});
</script>


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