I am trying to achieve a scenario where the '.child' image remains visible on the screen while the .parent div can be toggled between shown and hidden states. I have managed to make it appear once and disappear once, but I am struggling to make it recur consistently.
var main = function() {
$('#logo').on('click',function() {
$(this).parent('.parent').css('visibility', 'visible');
$('#logo').on('click',function() {
$(this).parent('.parent').css('visibility', 'hidden');
});
});
};
$(document).ready(main);
.jumbotron {
height: 250px;
width: 100%;
display: flex;
border: 1px solid green;
}
.parent {
margin: auto;
display: flex;
height: 200px;
width: 80%;
border: 1px solid black;
visibility: hidden;
}
.child {
width: auto;
height: 100px;
margin: auto;
visibility: visible;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class='jumbotron'>
<div class='parent'>
<img id='logo' class='child' src="http://content.sportslogos.net/logos/6/216/full/813.gif" />
</div>
</div>