You guys have been very helpful before. I've been searching stackoverflow for a while now, but can't come up with an answer.
Hopefully, this is a simple question. I'm trying to store the id of the currently hovered div in a variable. Then, I want to use that variable to toggle an image with the same id.
You can see that I've tried setting the variable directly to one of the id's and that works perfectly. I've tried lots of different techniques. What am I doing wrong?
Thanks in advance for any advice!
I have a jsFiddle here: http://jsfiddle.net/SN3mz/1/
JQUERY
$(document).ready(function () {
$('.hover').mouseenter(function() {
var currentId = $(this).attr("id");
// var currentId = "#story1";
$('.pshow').hide();
$('.feature').find(currentId).toggle();
});
});
HTML
<div class="row-fluid" id="homepage-spotlight">
<div class="feature" align="center">
<img class="pshow" id="preview" src="http://i.imgur.com/yuiHc20.png" alt=""/>
<img class="pshow" id="story1" style="display:none" src="#" />
<img class="pshow" id="story2" style="display:none" src="#" />
<img class="pshow" id="story3" style="display:none" src="#" />
<img class="pshow" id="story4" style="display:none" src="#" />
</div>
<div class="jdlthumbnail">
<div class="jdlh2"><span>Large Image Features Will Give More Pop.</span>
<div style="font-size:17px">by Ebenezer Ekuban</div>
</div>
<div class="hover" id="story1">
<a href="#"><h2 class="jdlh2b">Story #1 Text<br>Teaser</h2></a>
</div>
<div class="hover" id="story2">
<a href="#"><h2 class="jdlh2b">Story #2 Text<br>Teaser</h2></a>
</div>
<div class="hover" id="story3">
<a href="h#"><h2 class="jdlh2b">Story #3 Text<br>Teaser</h2></a>
</div>
<div class="hover" id="story4">
<a href="#"><h2 class="jdlh2b">Story #4 Text<br>Teaser</h2></a>
</div>
</div>
</div>