While I know this issue has been discussed before, I am facing a slight confusion regarding displaying an image on MouseOver. Currently, I have a div
container with a colored background that shows when hovered over. You can see an example of this here - scroll down to the image at the bottom.
The problem I'm encountering is related to a hidden button that I only want to be visible when the user hovers over .product-shot-bg
. I've tried to implement this functionality, but so far, I haven't been successful. Here's what I've attempted:
<script>
function show(#viewProductBtn){
document.getElementById(#viewProductBtn) = "visible";
}
function hide(#viewProductBtn){
document.getElementById(#viewProductBtn) = "hidden";
}
</script>
<style>
.product-shot-bg{
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
width: 208px;
height: 453px;
}
.product-shot-bg:hover{
background-color: #f3f3f3;
}
#viewProductBtn{
background: url(css/images/viewProductBtn.png) no-repeat;
width: 197px;
height: 40px;
float: left;
visibility: hidden;
}
</style>
<!-- Html -->
<div class="product-shot-bg" onMouseOver="show('#viewProductBtn')" onMouseOut="hide('#viewProductBtn')"><a href="#" id="viewProductBtn "></a>