I have numerous images that I need to have this js functionality. It works great with one, but when I add a second image and text, if I mouse over this or the first image it causes the text to display on both (their own text but the slide comes up). Can I change this js so it works for numerous images/text? Thank you.
JS:
//var yt_height = $('.youtube').height();
var adjust = 45;
var yt_height = $('.youtube').height() - adjust;
var top = yt_height - $('.yt-desc').height()+20;
$('.yt-desc').css({ top: yt_height + 'px' });
$(".youtube").hover(
function() { $('.yt-desc').animate({ top: top + 'px' }, 'slow') },
function() { $('.yt-desc').animate({ top: yt_height + 'px' }, 'slow') }
);
html:
<div class="youtube" style="margin-right: 30px">
<img src="/images/test1.jpg">
<div class="yt-desc">
<span style="font-weight: bold; font-size: 14px">Web Mapping Applications</span><br /><br />
<span style="font-size: 12px">Pellentesque habitant morbi tristique senectus et
netus et malesuada fames ac turpis egestas.fjdslfkj. Eelrjklej slk slekrje lskf dk jsldfk d</span>
</p>
</div>
</div>
<div class="youtube">
<img src="/images/test2.jpg">
<div class="yt-desc">
<span style="font-weight: bold; font-size: 14px">Law Enforcement</span><br /><br />
<span style="font-size: 12px">Pellentesque habitant morbi tristique senectus et
netus et malesuada fames ac turpis egestas.fjdslfkj. Eelrjklej slk slekrje lskf dk jsldfk d</span>
</p>
</div>
</div>
css:
.youtube {
background: #ccc;
float: left;
position: relative;
width: 310px;
height: 217px;
overflow: hidden;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border: 1px solid #ccc;
}
.youtube .yt-desc {
position: absolute;
color: #000;
left: 0px;
background: #ccc;
width: 300px;
padding-left: 10px;
padding-top: 17px;
padding-bottom: 20px;
line-height: 18px;
}