【问题标题】:jqplot tooltip display on touch instead of jqplotDataHighlight or higlightMouseOver or highlightMouseDownjqplot 工具提示在触摸时显示,而不是 jqplotDataHighlight 或 higlightMouseOver 或 highlightMouseDown
【发布时间】:2012-12-24 21:46:06
【问题描述】:

我正在使用 jqplotDataHighlight 选项在 MouseOver 上的图表上显示工具提示。

$("#"+sTargetId).bind('jqplotcustomDataHighlight', 
                       function (ev, seriesIndex, pointIndex, data) {    
                         var chart_left = $("#"+sTargetId).offset().left,
                         chart_right = ($(window).width() - ($("#"+sTargetId).offset().left + $("#"+sTargetId).outerWidth())),
                         chart_top = $("#"+sTargetId).offset().top,
                           x = oPlot.axes.xaxis.u2p(data[0]),  // convert x axis units to pixels
                           y = oPlot.axes.yaxis.u2p(data[1]);;
                           var tooltipData = data[1]*scale;
                          $('#tooltip').css({left:chart_left+x, top:chart_top+y, marginRight:chart_right});
                          $('#tooltip').html('<span style="font-family: Arial;font-size:'+sTooltip+';font:bold;color:#000000;">' +sXDisplay+': '+ tooltipData + '</span>');
                         $('#tooltip').show();
                       });

            $("#"+sTargetId).bind('jqplotcustomDataUnhighlight', 
                     function (ev, seriesIndex, pointIndex, data) {
                         $('#tooltip').empty();
                         $('#tooltip').hide();
                     });

它工作正常。在 iPad 上,我希望在某些触摸事件上显示工具提示。我该如何实现它?

        // prop: highlightMouseOver
        // True to highlight slice when moused over.
        // This must be false to enable highlightMouseDown to highlight when clicking on a slice.
this.highlightMouseOver = true;
        // prop: highlightMouseDown
        // True to highlight when a mouse button is pressed over a slice.
        // This will be disabled if highlightMouseOver is true.
this.highlightMouseDown = false;

我观察到只有以上两个选项可用。如何在 touchstart 上实现它? 在双击或任何其他事件上显示工具提示也会有帮助

【问题讨论】:

    标签: touch tooltip highlight jqplot touchstart


    【解决方案1】:

    也许你已经想通了。这对我有用。我正在使用jquerymobile,在jquery.jqplot.js version 0.9.7r635 行号:2290 将mousemove 更改为vmousemove。如果您使用的是 cursor: {followMouse: true} ,那么事情应该开箱即用,我的工具提示有一个固定的位置,但是在 mousemove 上,顶部和左侧的值没有被应用,所以我硬编码顶部和左侧的工具提示 div @ 987654326@ 出现在与单击时相同的位置。虽然它不是一个很好的解决方案,但到目前为止我还没有看到奇怪的行为。希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 2012-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多