I am currently developing a PHP/MySQL project that involves creating a function to display a brief description when a user hovers over an image. However, I seem to be encountering an issue where the function crashes after a few uses. Below is a snippet of the code and a JSFiddle link for reference:
JSFiddle: http://jsfiddle.net/c7d8g/
Code :
HTML :
<body>
<div class="card">
<img class="cover" src="http://www.unheap.com/wp-content/uploads/Blindify.png" />
<div class="coverDetail">
This is initially hidden
</div>
<div class="description">
<a class="title" href="#">About this card</a>
<p class="text">Description of this card.</p>
<p class="author">@alex</p>
</div>
</div>
</body>
CSS:
.card {
background: #0e0e0e;
color:#a4a4a4;
width:250px;
height:320px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
margin-right:20px;
margin-bottom: 15px;
float: left;
}
.cover {
max-width:250px;
max-height:140px;
background: transparent;
float:left;
-webkit-border-top-left-radius: 6px;
-webkit-border-top-right-radius: 6px;
-moz-border-radius-topleft: 6px;
-moz-border-radius-topright: 6px;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
}
.coverDetail {
position:absolute;
width:220px;
height:25px;
margin-top: 114px;
padding-left: 15px;
padding-right: 15px;
background: #e8ff28;
border-top: 1px solid #ecf97e;
overflow: hidden;
z-index:100;
}
.description {
width:100%;
height:50%;
display: block;
margin-top:150px;
}
.title {
color:#b4b4b4;
font-family: 'Yanone Kaffeesatz', sans-serif;
font-size: 20px;
text-decoration: none;
text-transform: uppercase;
margin-top:5px;
margin-left:10px;
overflow: hidden;
}
.title:hover {
color:#62c6ff;
border-bottom: 1px dotted #d9f1ff;
}
.text {
font-family: sans-serif;
font-size: 11px;
text-decoration: none;
text-transform: uppercase;
max-height: 85px;
margin-top: 5px;
margin-left: 10px;
width:90%;
overflow-y:hidden;
overflow-x:hidden;
}
.author, a {
bottom: 100%;
font-family: sans-serif;
text-decoration: none;
text-transform: lowercase;
font-size: 9px;
margin-left: 15px;
}
JS function that I have, but it crashes: :
<script>
$(document).ready(function(){
$(".cover").mouseover(function(){
$(this).next().stop().fadeIn();
});
$(".cover").mouseout(function(){
$(this).next().stop().fadeOut();
});
});
</script>
My Question:
I am seeking a solution that will effectively fadeIn the "coverDetail" element in the card when a user hovers over the cover image, and fade it out when the user moves the mouse away. This function needs to work well for each individual card, as I have around 150 cards per page.
Thank you :)