2017-02-09 4 views
-1

こんにちはdiv.it上のホバーのように表示しているとき、私はHTMLのリストを取得しようとしていますすべての[オブジェクトのオブジェクト] list.iのように見てコードhover divのときにhtmlリストを表示するには?

var type= "x,y,z,a"; 
var active = type.split(","); 
if (active .length == 0) 
    feature.attributes.ShowExceptionType = "display:none"; 
else 

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

var main = $("<ul>"); 
var str = ""; 
for (var i = 0; i < items.length; i++) { 
    str += "<li>" + items[i].active + "</li>"; 
} 
main.html(str); 
$(document.body).append(main); 

feature.attributes.HoverContent = $(document.body).append(main); 
"description": "{{localize:iplMap:Mac}} : {ESN}<br/><div style='{ShowExceptionCount}' class='cart' id='append'>{{localize:iplMap:ExceptionType}}: ({ExceptionCount})</div>", 

enter image description here

答えて

0

の下にしようとしたとして、私は表示することができます.howあなたは既にjQueryのを使用しているようにそれがどのように見えるか、あなたにも、このためにそれを使用することがあります。

https://jsfiddle.net/whmzt0nj/1/

は、私はまた、機能の文体のいずれかのためにあなたのコードのいくつかの部品を変更しました理由:

var type= "x,y,z,a"; 
var active = type.split(","); 

if (active.length == 0){ 
    feature.attributes.ShowExceptionType = "display:none"; 
} else { 
    var item, items = []; 
} 

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

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

$('#append').html("<ul id='append-list'></ul>"); 
$("#append-list").append(str); 

$('#append-list').hide(); 

$("#append").mouseenter(function(){ 
    $(this).children('#append-list').slideDown(); 
}) 

$("#append").mouseleave(function(){ 
    $(this).children('#append-list').slideUp(); 
}) 
+0

feature.attributes.HoverContent = $(document.body).append(main);にコールマウスを入力します。 – Raju

+0

なぜですか?あなたはすでにjQueryを持っています – OliverRadini

+0

はい、私は他のdiv.Onにこれをimplimentする必要があります私は私のコードを追加して表示する必要があります – Raju

関連する問題