Skip to content

Instantly share code, notes, and snippets.

@dkruchok
Created May 21, 2015 18:57
Show Gist options
  • Save dkruchok/fcd43de8abc29bf22ca8 to your computer and use it in GitHub Desktop.
Save dkruchok/fcd43de8abc29bf22ca8 to your computer and use it in GitHub Desktop.
Всплывашка блока при наведении.
<div class="cont">
<ul>
<li>
<a href="#">
<h3>title</h3>
</a>
<div class="hide_block">
<div class="hide_block_inner">
<div class="text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Recusandae.</div>
<a href="#" class="link" id="#">go</a>
</div>
</div>
</li>
</ul>
</div>
//////////
.hide_block {
display: none;
position: absolute;
top: 50%;
left: 40px;
background: #fff;
border: 1px solid #DDDDDD;
z-index: 999;
box-shadow: 1px 1px 13px #A8A8A8;
}
.hide_block_inner {
padding: 11px 20px;
font-family: "OpenSans-Regular";
font-size: 16px;
line-height: 19px;
color: #6C6C6C;
}
//////////////////////////
$(".block_two li").hover(function() {
var obj = $(this).find(".hide_block");
obj.css({
"display": "block"
});
var h = obj.height();
var mar = h / 2;
mar = "-" + mar + "px";
obj.css({
"margin-top": mar
});
}, function() {
$(this).find(".hide_block").css("display", "none");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment