All Components

Tooltip / Basic usage

HTML5/JavaScript 源码

<!DOCTYPE html>
<html>
 <head> 
  <title>Basic usage</title> 
  <meta charset="utf-8"> 
  <link href="../content/shared/styles/examples-offline.css" rel="stylesheet"> 
  <link href="../../styles/kendo.common.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.rtl.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.default.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.dataviz.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.dataviz.default.min.css" rel="stylesheet"> 
  <script src="../../js/jquery.min.js"></script> 
  <script src="../../js/kendo.all.min.js"></script> 
  <script src="../content/shared/js/console.js"></script> 
  <script>
        
    </script> 
 </head> 
 <body> 
  <a class="offline-button" href="../index.html">Back</a> 
  <div id="example"> 
   <div class="demo-section k-content wide"> 
    <div id="agglomerations"> 
     <a href="#" title="Canton - 26,300,000" id="canton"></a> 
     <a href="#" title="Jakarta - 25,800,000" id="jakarta"></a> 
     <a href="#" title="Mexico City - 23,500,000" id="mexico"></a> 
     <a href="#" title="Delhi - 23,500,000" id="delhi"></a> 
     <a href="#" title="Karachi - 22,100,000" id="karachi"></a> 
     <a href="#" title="New York - 21,500,000" id="newyork"></a> 
     <a href="#" title="Sao Paulo - 21,300,000" id="saopaolo"></a> 
     <a href="#" title="Mumbay/Bombay - 21,100,000" id="bombay"></a> 
     <a href="#" title="Los Angeles - 17,100,000" id="losangeles"></a> 
     <a href="#" title="Osaka - 16,800,000" id="osaka"></a> 
     <a href="#" title="Moscow - 16,200,000" id="moscow"></a> 
    </div> 
   </div> 
   <script>
                $(document).ready(function() {
                    var tooltip = $("#agglomerations").kendoTooltip({
                        filter: "a",
                        width: 120,
                        position: "top"
                    }).data("kendoTooltip");

                    tooltip.show($("#canton"));

                    $("#agglomerations").find("a").click(false);
                });
            </script> 
   <style>

                .demo-section.k-content,
                html.k-material .demo-section.k-content {
                    overflow: hidden;
                    padding: 0;
                    border: 0;
                    box-shadow: none;
                }
                
                #agglomerations {
                    position: relative;
                    width: 692px;
                    height: 480px;
                    margin: 0 auto;
                    background: url('../content/web/tooltip/world-map.jpg') no-repeat 0 0;
                }

                #agglomerations a {
                    position: absolute;
                    display: block;
                    width: 12px;
                    height: 12px;
                    background-color: #fff600;
                    -moz-border-radius: 30px;
                    -webkit-border-radius: 30px;
                    border-radius: 30px;
                    border: 0;
                    -moz-box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
                    -webkit-box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
                    box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
                    -moz-transition:  -moz-box-shadow .3s;
                    -webkit-transition:  -webkit-box-shadow .3s;
                    transition:  box-shadow .3s;
                }

                #agglomerations a:hover {
                    -moz-box-shadow: 0 0 0 15px rgba(0,0,0,0.5);
                    -webkit-box-shadow: 0 0 0 15px rgba(0,0,0,0.5);
                    box-shadow: 0 0 0 15px rgba(0,0,0,0.5);
                    -moz-transition:  -moz-box-shadow .3s;
                    -webkit-transition:  -webkit-box-shadow .3s;
                    transition:  box-shadow .3s;
                }

                #canton { top: 226px; left: 501px; }
                #jakarta { top: 266px; left: 494px; }
                #mexico { top: 227px; left: 182px; }
                #delhi { top: 214px; left: 448px; }
                #karachi { top: 222px; left: 431px; }
                #newyork { top: 188px; left: 214px; }
                #saopaolo { top: 304px; left: 248px; }
                #bombay { top: 233px; left: 438px; }
                #losangeles { top: 202px; left: 148px; }
                #osaka { top: 201px; left: 535px; }
                #moscow { top: 153px; left: 402px; }

                #canton:hover,
                #jakarta:hover,
                #mexico:hover,
                #delhi:hover,
                #karachi:hover,
                #newyork:hover,
                #saopaolo:hover,
                #bombay:hover,
                #losangeles:hover,
                #osaka:hover,
                #moscow:hover { z-index: 10; }

            </style> 
  </div>   
 </body>
</html>