Home > Mobile >  Im trying to create a pop-up box type when hovering over specific text, but the text only hides and
Im trying to create a pop-up box type when hovering over specific text, but the text only hides and

Time:12-08

Im trying to create a pop-up box that will pop-up when you hover over text. The text disappears but it does not reappear when you hover your mouse over it. Any improvements that can be made to the code below?

$(document).ready(function(){
  $("clo-t").hide();

  $("clo").hover(function(){
    $("clo-t").show();,
    $("clo-t").hide();
  });

})

CodePudding user response:

You should use mouseout and mouseover instead

$(document).ready(function() {
  $(".clo").mouseover(() => {
    $(".clo-t").show();
  }).mouseout(t => {
    if (!$(t.target).hasClass("clo-t"))
      $(".clo-t").hide();
  })
})
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

  • Related