I've created a pen: https://codepen.io/nickelse/pen/dROOGX
On the 2nd div I want the close button to the slide the parent div back up again, I can't figure out why it's not working, any suggestions?
$(".one").click(function(e) {
e.preventDefault();
e.stopPropagation();
// do your worst, i.e. slide down
$(".two").slideDown("slow");
});
$(".close").click(function() {
// slide up
$(".two").slideUp("slow");
});
.container {
overflow:hidden;
height: 60px;
}
.one {
position: relative;
top: 0;
background-color: lightblue;
z-index: 1;
}
.two {
position: relative;
background-color: yellow;
z-index: -1;
display:none;
}
/*
.one:hover + .two {
top: 0px;
}*/
.red-cell {background: red!important;}
.close {background: red; display:block;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<div class="container">
<div class="one">click me to reveal new div</div>
<div class="two">Search</div>
</div>
<div class="container">
<div class="one">click me to reveal new div</div>
<div class="two">Login
<div class="close">Close</div>
</div>
</div>