Search code examples
jqueryhtmlmouseout

Mouseout from div to neighboring div, keep main div open, mousout outside those divs, main div closes


Possible Duplicate:
Mouseout on specified divs and keep original div open

I asked a similar question and it got buried without any answer that solves this, so please don't flame me as I've waited and no answer works.

Here is the original question: Mouseout on specified divs and keep original div open

Here is the fiddle all set up: http://jsfiddle.net/bUzPG/10/

It seems like everything should work with the fiddle, but the code doesn't do what it should. Any working answer will be marked as solved, this is driving me crazy!


Solution

  • If I understand you correctly:

    $("#openDiv").mouseout(function (e) {
    var used_classes = ['x', 'z'];
    var $c = $(e.relatedTarget).attr('class');
    
       if ($c=='x' || $c=='z')
     {
         $("#openDiv").show().css('background-color', 'pink');
     }else{
        $("#openDiv").hide();
     }
      });