flot:悬停在绘图项上时更改鼠标光标

Sim*_*mon 3 mouse pointers cursor flot hover

我想知道在鼠标悬停在绘图项上时更改鼠标光标的最佳方法是什么,并在远离绘图项时将光标更改回默认值

plot.bind("plothover", function(event, pos, item) {
            if(item) {
                document.body.style.cursor = 'pointer';
                    } else {
                            document.body.style.cursor = 'pointer';
                    }
 }
Run Code Online (Sandbox Code Playgroud)

它在一开始就有用,但是在平底图之后不起作用......

小智 7

你很近.你的第二个光标设置行是不合适的.这是一个更正版本:

plot.bind("plothover", function(event, pos, item) {
    if(item) {
        document.body.style.cursor = 'pointer';
    } else {
        document.body.style.cursor = 'default';
    }
}
Run Code Online (Sandbox Code Playgroud)