使用工具提示时Div消失

时间:2015-11-15 14:36:48

标签: javascript jquery html css

我想在我的网站上使用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>

此测试示例中没有其他CSS而不是div的内联CSS。 请帮我解决这个神秘的问题。

1 个答案:

答案 0 :(得分:0)

<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>
相关问题