With this code, when you hover over anything with the id="trigger*", it shows everything with the id="panel*" I would like it, for trigger1 to show panel1, for trigger2 to show panel2.
Is that possible? This is my code:
$(document).ready(function(){
hovered = false;
$('*[id^=trigger]').bind('mouseenter mouseleave', function(event) {
switch(event.type) {
case 'mouseenter':
// when user enters the div
$('*[id^=panel]').show('fast');
break;
case 'mouseleave':
// leaves
setTimeout(function(){
if(!hovered) {
$('*[id^=panel]').hide('fast');
}}, 250);
break;
}
});
$('*[id^=panel]').mouseover(function(){
hovered = true;
}).mouseout(function(){
hovered = false;
$('*[id^=trigger]').trigger("mouseout");
});
});