Search code examples
javascriptjquerytooltipster

Make tootipster popup not hide


I have using tooltipster and don't want to hide it on mouseover, etc.

Here is code I have using

$("[data-toggle=popover]").tooltipster({
contentAsHTML: true,
placement: "auto",
content: $("#a1").html()

});

I tried to use timer:500, and autoClose: true, but it not works. When I mouseover tooltipster, it hides.

How I can prevent it?


Solution

  • You can use autoClose: false option to disable automatic closure of the tooltip.

    Refer to Tooltipster Options > Trigger & TriggerClose if you need to manually close the tooltip.


    $("[data-toggle=popover]").tooltipster({
      contentAsHTML: true,
      placement: "auto",
      autoClose: false,
      content: $("#a1").html()
    });
    div:not(#a1) {
      border: 1px solid;
      height: 100px;
      width: 100px;
    }
    <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/tooltipster/3.3.0/js/jquery.tooltipster.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/tooltipster/3.3.0/css/tooltipster.min.css" rel="stylesheet"/>
    
    <br><br><br><br><br><br><br><br>
    <div data-toggle="popover"></div>
    
    <div id="a1">Hello World</div>