Log In

Email:
Password:
Keep me logged in

Forgot Password

Email:




CategoriesCSS (4)
jQuery (56)
PHP (26)
.htaccess (2)
Sponsored Links



Hover Element, Show Another
Thursday, December 1, 2011 by William Thomas



Code:
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(function(){
$(".group").mouseover(function(){
var child = $(this).children(".hidden_content"); //HIDDEN CONTENT OBJECT
var height = child.height(); //HIDDEN CONTENT'S HEIGHT
child.css({"margin-top":"-"+height+"px"}).show(); //SHOWS CONTENT JUST COMPLETELY ABOVE MAIN CONTENT
}).mouseout(function(){
$(this).children(".hidden_content").hide(); //CONTENT IS HIDDEN AGAIN
});
});
</script>
<style>
.group {
position: relative; !important
}
.hidden_content {
display: none; !important
position: absolute; !important
width: inherit;
z-index: 1;
}
</style>
</head>
<div class="group">
<div class="hidden_content">Sup-Content 1</div>
Content 1
</div><br><br>
<div class="group">
<div class="hidden_content">Sup-Content 2</div>
Content 2
</div><br><br>
<div class="group">
<div class="hidden_content">Sup-Content 1</div>
Content 1
</div><br><br>
<div class="group">
<div class="hidden_content">Sup-Content 2</div>
Content 2
</div>
</body>
</html>
Views: 107 Likes: 0 Dislikes: 0