div displayed by hover and still displayed

34 Views Asked by At

I need help in "jquery" code that do that: First we can tell I have two div's (div 1)'visible' and (div 2)'hidden' , I want to make hover on (div 1) make (div 2)'visible'.then: Second when I move with mouse to (div 2) disappered , I want (div 2)and(div 1) be visible till I stay in any one of them

Make two div's are visible if I stay on one of them

1

There are 1 best solutions below

0
Hari R On

I think you are trying to say that you have two div say div1 and div2(initially hidden), when div1 is hovered,div2 is visible and it is visible also when hovered on div2 and disappears when mouse leaves. Here is the solution you are looking for!

HTML:

<div class="div1">Div-1</div>
<div class="div2">Div-2</div>

CSS:

.div2 {
  display: none;
}

Jquery:

$(document).ready(function() {}
    $(".div1").mouseenter(function() {
      $(".div2").show();
    });
    $(".div2").mouseleave(function() {
      $(".div2").hide();
    });
    $(".div2").mouseenter(function() {
      $(".div2").show();
    });
  });