使用工具提示时Div消失

Div vanishes when using tooltipster

本文关键字:Div 消失 工具提示      更新时间:2023-09-26

我想为我的网站使用jquery插件工具提示。但是,每当我想添加工具提示来执行div时,div本身就会消失。有趣的是,当我将鼠标悬停在div的位置时,我仍然可以看到工具提示。

HTML:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Bootstrap 101 Template</title>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.0.min.js"></script>
        <script type="text/javascript" src="js/jquery.tooltipster.min.js"></script>
        <link rel="stylesheet" type="text/css" href="css/tooltipster.css" />
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link rel="stylesheet" type="text/css" href="MyStyle.css"></link>
    </head>
    <body>
        <div style="background-color:green; width:500px; height:500px;" class="tooltip" title="This is my div's tooltip message!"></div>
        <script>
            $(document).ready(function() {
                $('.tooltip').tooltipster();
            });
        </script>
    </body>
</html>

在这个测试示例中,除了div的内联CSS之外,没有其他CSS。请帮我解决这个神秘的问题。

<div style="background-color:green; width:500px; height:500px;" class="tooltip" title="This is my div's tooltip message!">You Must add content here</div>

试试这个。。。

<html>
    <html lang="en">
    <head>
      <title>Bootstrap 101 Template</title>
      <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
      <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    </head>
    <body>
    <div class="container"  style="background-color:green; width:500px; height:500px;">
<h1>Here is the example</h1>
      <a href="#" style="color:#ff0000;" data-toggle="tooltip" title="This is my div's tooltip message!">Hover Over Me</a>
    </div>
    <script>
    $(document).ready(function(){
        $('[data-toggle="tooltip"]').tooltip();   
    });
    </script>
    </body>
    </html>