jtr*_*ans 3 jquery kendo-ui kendo-tooltip
通过将参数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
...
}
});
Run Code Online (Sandbox Code Playgroud)
是否有可能在展会上实现同样的目标?上面的代码不起作用.
您始终可以通过调用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");
Run Code Online (Sandbox Code Playgroud)
见演示:http://jsfiddle.net/lhoeppner/mcpxj/
| 归档时间: |
|
| 查看次数: |
8024 次 |
| 最近记录: |