I am trying to show a div of information on a bar graph if the user hovers over the bar for a second. The answers on this site have gotten me to this point
var timer;
$(".session_hover").on({
'mouseover': function () {
timer = setTimeout(function () {
$(this).children('.session_info').css({'top':175,'right':20}).fadeIn('fast');
}, 1000);
},
'mouseout' : function () {
clearTimeout(timer);
}
});
The above code works when I replace $(this)
with $(".session_hover")
but then, of course it triggers all the other $(".session_hover")
on the page.
How can I pass $(this)
into my setTimeout
function so that it only applies to the child element of the div I am hovering over?
Thanks for your help!