title | page_title |
---|---|
Tooltip |
Configuration, methods and events of Kendo UI Tooltip |
Represents the Kendo UI Tooltip. Inherits from Widget.
Specifies if the Tooltip will be hidden when mouse leaves the target element. If set to false a close button will be shown within Tooltip. If set to false, showAfter is specified and the showOn is set to "mouseenter" the Tooltip will be displayed after the given timeout even if the element is no longer hovered.
<span id="target" title="Tooltip content">
Some Content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
autoHide: false
});
});
</script>
A collection of {Animation} objects, used to change default animations. A value of false will disable all animations in the widget.
<span id="target" title="Tooltip content">
Some Content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
animation: false
});
});
</script>
The animation that will be used when a Tooltip closes.
<span id="target" title="Tooltip content">
Some Content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
animation: {
close: {
effects: "fade:out"
}
}
});
});
</script>
Effect to be used for closing of the Tooltip.
<span id="target" title="Tooltip content">
Some Content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
animation: {
close: {
effects: "fade:out"
}
}
});
});
</script>
Defines the animation duration.
<span id="target" title="Tooltip content">
Some Content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
animation: {
close: {
duration: 1000
}
}
});
});
</script>
The animation that will be used when a Tooltip opens.
<span id="target" title="Tooltip content">
Some Content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
animation: {
open: {
effects: "fade:in",
duration: 1000
}
}
});
});
</script>
Effect to be used for opening of the Tooltip.
<span id="target" title="Tooltip content">
Some Content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
animation: {
open: {
effects: "fade:in"
}
}
});
});
</script>
Defines the animation duration.
<span id="target" title="Tooltip content">
Some Content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
animation: {
open: {
duration: "1000"
}
}
});
});
</script>
The text or a function which result will be shown within the Tooltip. By default the Tooltip will display the target element title attribute content.
If the content passed to the Tooltip includes scripts, they will be executed. If this is not desired, make sure to strip any undesired content in advance.
<div id="container">
<span>Some content</span>
<span>Some more content</span>
</div>
<script>
$(document).ready(function() {
$("#container").kendoTooltip({
filter: "span",
content: function(e) {
var target = e.target; // the element for which the tooltip is shown
return target.text(); // set the element text as content of the tooltip
}
});
});
</script>
<span id="target">
Some content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
content: "Tooltip content!"
});
});
</script>
Specifies a URL or request options that the Tooltip should load its content from.
Note: For URLs starting with a protocol (e.g. http://), a container iframe element is automatically created. This behavior may change in future versions, so it is advisable to always use the iframe configuration option.
<span id="target" title="Tooltip content">
Some content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
content: {
url: "http://demos.telerik.com/kendo-ui/content/web/tooltip/ajax/ajaxContent3.html"
},
width: 220,
height: 280
});
});
</script>
Specifies if the Tooltip callout will be displayed.
<span id="target" title="Tooltip content">
Some content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
callout: false
});
});
</script>
Specifies a selector for elements, within the container, for which the Tooltip will be displayed.
<div id="container">
I'm a <strong title="First target">tooltip target</strong>. I'm also a
<strong title="Second target">tooltip target</strong>.
</div>
<script>
$(document).ready(function() {
$("#container").kendoTooltip({
filter: "strong"
});
});
</script>
Explicitly states whether content iframe should be created.
The height (in pixels) of the Tooltip.
<span id="target" title="Tooltip long content">
Some content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
height: 80
});
});
</script>
The width (in pixels) of the Tooltip.
<span id="target" title="Tooltip long content">
Some content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
width: 180
});
});
</script>
The position relative to the target element, at which the Tooltip will be shown. Predefined values are "bottom", "top", "left", "right", "center".
<span id="target" title="Tooltip content">
Some content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
position: "right"
});
});
</script>
Specify the delay in milliseconds before the Tooltip is shown. This option is ignored if showOn
is set to "click" or "focus".
<span id="target" title="Tooltip content">
Some content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
showAfter: 1000
});
});
</script>
The event on which the Tooltip will be shown. Predefined values are "mouseenter", "click" and "focus".
<span id="target" title="Tooltip content">
Click Me
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
showOn: "click"
});
});
</script>
Shows the Tooltip for given target.
<div id="container">
<span id="target" title="Tooltip content">Tooltip target</span>
</div>
<script>
$(document).ready(function() {
var tooltip = $("#container").kendoTooltip().data("kendoTooltip");
tooltip.show($("#target"));
});
</script>
The target element for which the Tooltip should be shown.
Hides the Tooltip.
<div id="container">
<span title="Tooltip content">Tooltip target</span>
</div>
<button id="hideTooltip" class="k-button">Hide tooltip</button>
<script>
$(document).ready(function() {
var tooltip = $("#container").kendoTooltip({
filter: "span",
autoHide: false,
position: "right"
}).data("kendoTooltip");
$("#hideTooltip").click(function() {
tooltip.hide();
});
});
</script>
Refresh the Tooltip content.
<div id="container">
<span id="target" title="Tooltip content">Tooltip target</span>
</div>
<button id="refreshButton" class="k-button">Refresh Content</button>
<script>
$(document).ready(function() {
var tooltip = $("#container").kendoTooltip({
filter: "span",
position: "right",
content: function() {
return "last time refreshed: " + kendo.format("{0:T}", new Date());
}
}).data("kendoTooltip");
$("#refreshButton").click(function() {
tooltip.refresh();
});
});
</script>
Gets the Tooltip current target.
<div id="container">
<span id="target1" title="Tooltip1 content">Tooltip target1</span> <br />
<span id="target2" title="Tooltip2 content">Tooltip target2</span>
</div>
<button id="targetButton" class="k-button">Log target</button>
<script>
$(document).ready(function() {
var tooltip = $("#container").kendoTooltip({
filter: "span",
autoHide: false,
position: "right"
}).data("kendoTooltip");
$("#targetButton").click(function() {
var target = tooltip.target();
if (target) {
console.log(target.attr("id"));
}
});
});
</script>
jQuery
The target element or null.
Triggered when an AJAX request for content completes.
<span id="target" title="Tooltip content">
Some content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
content: {
url: "http://demos.telerik.com/kendo-ui/content/web/tooltip/ajax/ajaxContent3.html"
},
width: 220,
height: 280,
contentLoad: function() {
console.log("content is loaded");
}
});
});
</script>
<span id="target" title="Tooltip content">
Some content
</span>
<script>
$(document).ready(function() {
var tooltip = $("#target").kendoTooltip({
content: {
url: "http://demos.telerik.com/kendo-ui/content/web/tooltip/ajax/ajaxContent3.html"
},
width: 220,
height: 280
}).data("kendoTooltip");
tooltip.bind("contentLoad", function() {
console.log("content is loaded");
});
});
</script>
Triggered when a Tooltip is shown.
<span id="target" title="Tooltip content">
Some content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
show: function() {
console.log("tooltip is shown");
}
});
});
</script>
<span id="target" title="Tooltip content">
Some content
</span>
<script>
$(document).ready(function() {
var tooltip = $("#target").kendoTooltip({
}).data("kendoTooltip");
tooltip.bind("show", function() {
console.log("tooltip is shown");
});
});
</script>
<div id="container">
<span id="target" title="Tooltip content">Tooltip target</span>
</div>
<script>
$(document).ready(function() {
$("#container").kendoTooltip({
filter: "span",
position: "right",
content: function() {
return "last time refreshed: " + kendo.format("{0:T}", new Date());
},
show: function() {
this.refresh();
}
});
});
</script>
Triggered when a Tooltip is hidden
<span id="target" title="Tooltip content">
Some content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
hide: function() {
console.log("tooltip is hidden!");
}
});
});
</script>
<span id="target" title="Tooltip content">
Some content
</span>
<script>
$(document).ready(function() {
var tooltip = $("#target").kendoTooltip().data("kendoTooltip");
tooltip.bind("hide", function() {
console.log("tooltip is hidden!");
});
});
</script>
Triggered before an AJAX request started. Note that this event is triggered only when an AJAX request, instead of an iframe, is used.
<span id="target" title="Tooltip content">
Some content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
iframe: false,
content: {
url: "http://demos.telerik.com/kendo-ui/content/web/tooltip/ajax/ajaxContent3.html"
},
width: 220,
height: 280,
requestStart: function(e) {
console.log("request is started");
}
});
});
</script>
<span id="target" title="Tooltip content">
Some content
</span>
<script>
$(document).ready(function() {
var tooltip = $("#target").kendoTooltip({
iframe: false,
content: {
url: "http://demos.telerik.com/kendo-ui/content/web/tooltip/ajax/ajaxContent3.html"
},
width: 220,
height: 280
}).data("kendoTooltip");
tooltip.bind("requestStart", function(e) {
console.log("request is started");
});
});
</script>
The target element, for which the Tooltip is shown.
The request options which will be set to jQuery.ajax or to the iframe
Triggered when an AJAX request for content fails.
<span id="target" title="Tooltip content">
Some content
</span>
<script>
$(document).ready(function() {
$("#target").kendoTooltip({
iframe: false,
content: {
url: "http://demos.telerik.com/kendo-ui/content/web/tooltip/ajax/ajaxContent3.html"
},
width: 220,
height: 280,
error: function(e) {
console.log("error");
}
});
});
</script>
<span id="target" title="Tooltip content">
Some content
</span>
<script>
$(document).ready(function() {
var tooltip = $("#target").kendoTooltip({
iframe: false,
content: {
url: "http://demos.telerik.com/kendo-ui/content/web/tooltip/ajax/ajaxContent3.html"
},
width: 220,
height: 280
}).data("kendoTooltip");
tooltip.bind("error", function(e) {
console.log("error");
});
});
</script>
The XHR request object, as returned from jQuery.ajax
The status of the request, as returned from jQuery.ajax