I have a container div. Inside the container, apart from the article's title, there is a hidden div (position:abolute, next to the article's title & "outside" of the container div) which contains the article's image and trimmed text.
What I want: User hovers over article's title:
<div class="field-title"><span class="field-content"><a href="#">Lorem Ipsum</a></span></div>
As a result, the popup
<div class="article_popup">
fades in next to the article's title container.
If user doesn't hover over popup, popup fades out after 1 sec. If he does, popu stays visible as long as user mousesover the popup, then fades out after 1 sec.
Problems:
-1- There are many article containers & popup divs sharing the same class so all popups appear if only 1 title is hovered.
-2- I've tried this and similar solutions:
(function ($) {
$(document).ready(function(){
$('.field-title').bind('mouseenter', function() {
$('.article_popup').fadeIn();
});
$('.field-title').bind('mouseleave', function() {
$('.article_popup').fadeOut();
});
});
}(jQuery));
But this doesn't cover the case where user hovers over the popup itself.
update: http://jsfiddle.net/zThP7/14/
Here is my HTML (as you can see there many nested divs with the same classes):
<div class="container_block">
<table class="container_table">
<tbody>
<tr class="row-1">
<td class="col-1">
<div class="field-title"><span class="field-content"><a href="#">Lorem Ipsum</a></span></div>
<div class="article_popup_container">
<div class="field-content">
<div class="article_popup">
<div class="article_popup_photo"><a href="#"><img src="http://image_path"/></a></div>
<div class="article_popup_text">Lorem Ipsum</div>
</div>
</div>
</div>
</td>
<td class="col-2">
<div class="field-title"><span class="field-content"><a href="#">Lorem Ipsum</a></span></div>
<div class="article_popup_container">
<div class="field-content">
<div class="article_popup">
<div class="article_popup_photo"><a href="#"><img src="http://image_path"/></a></div>
<div class="article_popup_text">Lorem Ipsum</div>
</div>
</div>
</div>
</td>
</tr>
<tr class="row-2">
<td class="col-1">
<div class="field-title"><span class="field-content"><a href="#">Lorem Ipsum</a></span></div>
<div class="article_popup_container">
<div class="field-content">
<div class="article_popup">
<div class="article_popup_photo"><a href="#"><img src="http://image_path"/></a></div>
<div class="article_popup_text">Lorem Ipsum</div>
</div>
</div>
</div>
</td>
<td class="col-2">
<div class="field-title"><span class="field-content"><a href="#">Lorem Ipsum</a></span></div>
<div class="article_popup_container">
<div class="field-content">
<div class="article_popup">
<div class="article_popup_photo"><a href="#"><img src="http://image_path"/></a></div>
<div class="article_popup_text">Lorem Ipsum</div>
</div>
</div>
</div>
</td>
</tr>
<tr class="row-3">
<td class="col-1">
<div class="field-title"><span class="field-content"><a href="#">Lorem Ipsum</a></span></div>
<div class="article_popup_container">
<div class="field-content">
<div class="article_popup">
<div class="article_popup_photo"><a href="#"><img src="http://image_path"/></a></div>
<div class="article_popup_text">Lorem Ipsum</div>
</div>
</div>
</div>
</td>
<td class="col-2">
<div class="field-title"><span class="field-content"><a href="#">Lorem Ipsum</a></span></div>
<div class="article_popup_container">
<div class="field-content">
<div class="article_popup">
<div class="article_popup_photo"><a href="#"><img src="http://image_path"/></a></div>
<div class="article_popup_text">Lorem Ipsum</div>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
I prefer this to be solved with custom code, not a suggested jquery plugin but if it get's too complicated, a functional & cross-browser compatible plugin would be OK.