我正在编写一个JavaScript应用程序,并且找到了一个不错的库qtip2。我的目标是当用户将鼠标悬停在表中的每个单元格上时,将显示不同的信息。我上面提到的那个库的工作是在一个小的弹出窗口中显示信息。但是,我不确定将鼠标悬停在其他地方时如何设置此功能以显示每个单元格的特定内容。有人知道我该怎么做吗?

function showInfo()
    {
            $('#demo-mouse').qtip({
                content : 'I position myself at the current mouse position',
                position : {
                    my : 'top left',
                    target : 'mouse',
                    viewport : $(window),       //keep it on-screen at all time if possible
                    adjust : {
                        x : 10, y : 10
                    }
                },
                hide : {
                    fixed : true                // Helps to prevent the tooltip from hiding occassionaly when tracking!
                },
                style : 'ui-tooltip-shadow'
        });
    }

最佳答案

您可以使用扩展的content属性,并在要显示提示的元素中使用类:

10-05 21:03
查看更多