jQplot tooltip on click

767 Views Asked by At

I'm using the jqplot's highlighter plugin at http://www.jqplot.com/tests/cursor-highlighter.php. As I am using it on mobile, I would like the tooltip to show on click/touch instead of on hover. Is there a way to do it?

I've tried changing

$.jqplot.eventListenerHooks.push(['jqplotMouseMove', handleMove]);

on the beginning of jqplot.highlighter.js to

$.jqplot.eventListenerHooks.push(['jqplotDataClick', handleMove]);

but with no sucess. Maybe I'm understanding the whole thing wrong?

(in the meanwhile, I found the solution: if you are using modernizr, replace the line above with:

var monitorTouch;

if($('html').hasClass('touch')) {
    monitorTouch = 'jqplotClick';
} else {
    monitorTouch = 'jqplotMouseMove';
}

$.jqplot.eventListenerHooks.push([monitorTouch, handleMove]);

This way, if your mobile device has touch enabled, the tooltip will activate on click; else, it will activate on mouseover.

0

There are 0 best solutions below