2017-02-10 71 views
0

嗨,我想顯示列表上的鼠標懸停如果長度是> 0,然後我顯示count.On列表上的鼠標我想顯示list.But在我的情況列表總是顯示時,長度是> o.How顯示僅在鼠標懸停時列出? 究竟我試圖爲如何在javascript中顯示鼠標懸停列表?

if (feature.attributes.hasOwnProperty("ExceptionType")) { 

        var exceptionType = 'x,y'; 
        if (exceptionType) 
        { var activeExceptions = exceptionType.split(','); } 
        else 
        { var activeExceptions = []; } 

        var item, items = []; 
        for (var i = 0; i < activeExceptions.length; i++) { 
         item = {}; 
         item.activeexception = activeExceptions[i]; 
         items.push(item); 
        } 

        var main = $("<ul>"); 
        var str = "<ul>"; 
        for (var i = 0; i < items.length; i++) { 
         str += "<li>" + items[i].activeexception + "</li>"; 
        } 
        $('[rel="tooltip"]').tooltip(); 

        main.html(str); 
        if (activeExceptions.length == 0) { 
         feature.attributes.Hoverlist = ".showme{display: none}"; 
         feature.attributes.ShowExceptionType = "display:none"; 

        } 

        else 

         feature.attributes.Hoverlist = ".showhim:hover .showme{ display : block;}"; 
         feature.attributes.ShowExceptionType = "display:block"; 
         feature.attributes.HoverContent = str; 
         feature.attributes.ExceptionCount = activeExceptions.length; 


       } 

    "description": "<div class='showhim' style='{ShowExceptionType}' ng-mouseover='alert('hi');'>{ExceptionCount}<div class='showme' style='{Hoverlist}'>{HoverContent}</div></div>", 

回答

0

問題是我需要的時候彈出負荷把我的提示在上面。

$('[rel="tooltip"]').tooltip();