I am trying to add a Jquery function for updating a div on hover of a link inside a span my html structure is
<ul><li>
<div class="timeline">
<span>by</span>
<span class="vcard">
<a class="underline user-link" href="/users/aruna">Aruna </a>
</span>
<div style="display: none;" class="image_hover">
Student
<p>
<a onclick="" href="#">Show additional details</a>
<a href="#">view</a>
<p>Employee ID : </p>
<p>Project Name: </p>
<p>Project Role : r</p>
<p>Supervisor Name : </p>
</p>
</div>
<span class="timeline">about 1 day ago</span>
</div>
</li>
<li>
<div class="timeline">
<span>by</span>
<span class="vcard">
<a class="underline user-link" href="/users/jasmine">jasmine </a>
</span>
<div style="display: none;" class="image_hover">
Professor
<p>
<a onclick="" href="#">Show additional details</a>
<a href="#">view</a>
<p>Employee ID : </p>
<p>Project Name: </p>
<p>Project Role : r</p>
<p>Supervisor Name : </p>
</p>
</div>
<span class="timeline">about 1 day ago</span>
</div>
</li>
</ul>
The jQuery i have written is
I wrote like
jQuery(document).ready(function(){
var _selectedLinkEl = null;
var _detailEl = null;
var body = jQuery("body");
var elem=null;
jQuery(".user-link").mouseover(function(event) {
_selectedLinkEl = this;
_detailEl=jQuery(event.target).parent().next();
//_detailEl.show();
_detailEl.fadeIn("slow");
elem=jQuery(this).parent().next();
_href=jQuery(this).attr('href').split("/")[2];
jQuery.post('/users/user_detail/?name='+_href,
function(data){
//elem.html(data).show();
elem.html(data).fadeIn("slow");
});//post
body.mouseover(_bodyMouseOverFunction);
}); // user-link
var _bodyMouseOverFunction = function(event) {
if(event.target != _selectedLinkEl &&
event.target != _detailEl &&
jQuery.inArray(_detailEl, jQuery(event.target).parent() ) == -1) {
//_detailEl.hide();
_detailEl.fadeOut("slow");
body.unbind("mouseover", _bodyMouseOverFunction);
}
};// mouseover
});
The above jquery updates the image-hover div and its displaying the div by fadeIn but its getting fadeout at all times .
I am trying to fade out the DIV image_hover only if my mouse hover is out of the div(image_hover) or any body elements..
In the cases , if my mouse is on the link or on the div or on any of the elements inside the div (image_hover) , the Div should not fadeout..
Please give suggestions for this/.
How to do so ??