if i mouseover on my nick in stackoverflow on top page that show me new menu with * activity
* privileges
* logout etc. how can i make it? i maked something:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<style type="text/css">
#ONE {
background-color: #888;
width: 500px;
height: 500px;
}
#TWO {
background-color: blue;
width: 50px;
height: 50px;
}
#THREE {
background-color: yellow;
width: 200px;
height: 200px;
display: none;
}
#four {
background-color: red;
width: 200px;
height: 200px;
}
</style>
<script type="text/javascript">
$(document).ready(
function()
{
$("#TWO").click(
function()
{
$("#THREE").toggle();
});
});
</script>
<div id="ONE">
<div id="TWO">
</div>
<div id="four">
</div>
<div id="THREE">
</div>
</div>
sample image: http://img231.imageshack.us/img231/3885/threej.png
- default
- click for blue div
- how can i it make?
If I understand correctly, you’re asking how to make the yellow
divappear up beside the blue one, as you have it in the third mockup? If that’s the case, then:You’ll want to read up on CSS Positioning. In a nutshell, to make the yellow
divsit over everything like that, it needs to takeposition: absolute;It’ll be positioned in relation to it’s nearest ancestor that has positioning, so set#ONEtoposition: relative;So:
This will make the top-left of
#THREEshift to the far right of and a quarter of the way down#ONE. The absolute positioning also takes it out of the flow of the document, allowing it to overlap other elements.