【问题标题】:Kendo UI Tooltip on show, access target?Kendo UI Tooltip 显示,访问目标?
【发布时间】:2013-11-21 10:58:21
【问题描述】:

通过将参数 e 传递给内容的匿名函数可以访问目标。

gridToolTipz = $('#grid').kendoTooltip({ 
    filter: "td[role=gridcell]",
    content: function (e) {
            var target = e.target; // the element for which the tooltip is shown
            ...
    },
    show: function(e) {
            var target = e.target; // the element for which the tooltip is shown
            ...
    }
});

是否有可能在展会上实现相同的目标?上面的代码不起作用。

【问题讨论】:

    标签: jquery kendo-ui kendo-tooltip


    【解决方案1】:

    您始终可以通过调用tooltip.target() 来访问目标元素:

    var toolTip = $('#grid').kendoTooltip({
        filter: "td[role=gridcell]",
        content: function (e) {
            var target = e.target; // the element for which the tooltip is currently shown
            return "Content is: " + target.text(); // use current element for content
        },
        show: function (e) {
            var target = this.target(); // the element for which the tooltip is currently  shown
    
            if (target) {           
                console.log("now showing with content: ");
                console.log(target.text());
            }
        }
    }).data("kendoTooltip");
    

    查看演示:http://jsfiddle.net/lhoeppner/mcpxj/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-10-28
      • 1970-01-01
      • 1970-01-01
      • 2020-03-04
      • 2016-02-23
      • 2017-04-28
      • 1970-01-01
      相关资源
      最近更新 更多