[英]Jquery for Tooltip
I'm using the below code for tooltip display for click event 我将以下代码用于Click事件的工具提示显示
Html Component: HTML组件:
<a href="#" class="tooltip" data-description="Test tooltip">Test</a><br>
JQuery: jQuery的:
$(document).on("click", ".tooltip", function() {
$(this).tooltip(
{
items: ".tooltip",
content: function(){
return $(this).data('description');
},
close: function( event, ui ) {
var me = this;
ui.tooltip.hover(
function () {
$(this).stop(true).fadeTo(400, 1);
},
function () {
$(this).fadeOut("400", function(){
$(this).remove();
});
}
);
ui.tooltip.on("remove", function(){
$(me).tooltip("destroy");
});
}
}
); // this is the line i'm getting "Expected Identifier, string or number".
$(this).tooltip("open");
});
I'm using jquery 1.9.1.js and jquery-ui.1.9.2.js. 我正在使用jquery 1.9.1.js和jquery-ui.1.9.2.js。 But I'm getting "Expected Identifier, string or number".
但是我得到“期望的标识符,字符串或数字”。
EDIT: Error resolved, but still I'm not getting tool tip on click event. 编辑:错误已解决,但我仍未获得有关单击事件的工具提示。
Could someone tell me where I went wrong? 有人可以告诉我我哪里出问题了吗?
This Codepen: http://codepen.io/anon/pen/EjVBOW seems to work for me with your code and latest jQuery and jQuery UI. 该Codepen: http ://codepen.io/anon/pen/EjVBOW似乎对我来说适合您的代码以及最新的jQuery和jQuery UI。 Did it get resolved for you?
它为您解决了吗?
$(document).on("click", ".tooltip", function() {
$(this).tooltip({
items: ".tooltip",
content: function() {
return $(this).data('description');
},
close: function(event, ui) {
var me = this;
ui.tooltip.hover(
function() {
$(this).stop(true).fadeTo(400, 1);
},
function() {
$(this).fadeOut("400", function() {
$(this).remove();
});
}
);
ui.tooltip.on("remove", function() {
$(me).tooltip("destroy");
});
}
}); // this is the line i'm getting "Expected Identifier, string or number".
$(this).tooltip("open");
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.