jQuery 工具提示随机出现
jQuery tooltip random appear
我正在开发这个 "logo colors"。单击后,我需要工具提示出现在 ID 为 #show
的 DIV 中(这没问题)。但是在悬停按钮后,工具提示会出现在它想要的任何地方。
在这里访问我的问题:http://web-stranky.org/pro_dementa/
$(document).ready(function () {
$( document ).tooltip( {
content: function() {
return $( this ).attr( "title" );
}
});
$('button').click(function(){
$('#show').html($('#' + $(this).attr('aria-describedby')).children().html());
});
});
您还没有包含 jquery-ui.css
。只需在文档中添加它就可以了!!
你可以从here
获取
更新
如果您需要在 div 中连同 html
添加 title
属性,并如下所示从其他元素中删除 title 属性
$('#show').html($('#' + $(this).attr('aria-describedby')).children().html());
$('#show').attr('title',$('#' + $(this).attr('aria-describedby')).children().html()); //add this
我正在开发这个 "logo colors"。单击后,我需要工具提示出现在 ID 为 #show
的 DIV 中(这没问题)。但是在悬停按钮后,工具提示会出现在它想要的任何地方。
在这里访问我的问题:http://web-stranky.org/pro_dementa/
$(document).ready(function () {
$( document ).tooltip( {
content: function() {
return $( this ).attr( "title" );
}
});
$('button').click(function(){
$('#show').html($('#' + $(this).attr('aria-describedby')).children().html());
});
});
您还没有包含 jquery-ui.css
。只需在文档中添加它就可以了!!
你可以从here
获取更新
如果您需要在 div 中连同 html
添加 title
属性,并如下所示从其他元素中删除 title 属性
$('#show').html($('#' + $(this).attr('aria-describedby')).children().html());
$('#show').attr('title',$('#' + $(this).attr('aria-describedby')).children().html()); //add this