我正在使用tippyjs
https://atomiks.github.io/tippyjs/插件作为用户列表工具提示
问题: click
不适用于上述(图片)list item
,因为styling
我必须得到refrence
并做styling
(困难,请参阅onShow()
)。
注意: click
打开...
查看工具提示
代码笔: https ://codepen.io/anon/pen/eQrwQM ?editors=0110#0
$.ajax({url:"https://jsonplaceholder.typicode.com/users",
success:function(json){
var logoutpage = '<ul class="all-users-content">';
json.forEach((obj) => { logoutpage += '<li>'+obj.name+'</li>';});
logoutpage += '</ul>';
// actual tippy.js code
tippy('.logout-top-corner', {
content: logoutpage,
delay: 100,
arrow: true,
arrowType: 'round',
size: 'large',
duration: 500,
animation: 'scale',
trigger:'click',
allowHTML:true,
hideOnClick:true,
// zIndex:9999999,
onShow:function(){
var refrence = document.querySelector('.logout-top-corner');
var tip = refrence._tippy;
var id = tip.id;
setTimeout(function(){
$('#tippy-'+id +' .tippy-tooltip.dark-theme').css({background:'#fff',border:'1px solid #ccc'});
$('#tippy-'+id +' .tippy-roundarrow').css({fill:'#eaeaed'});
},200);
},
onShown:function(){
console.log($(this));
$(document).off('click','.all-users-content li');
$(document).on('click','.all-users-content li',function(){
alert('clicked');
});
}
});
}
});
请帮助我提前谢谢!!!!!!!