随机出现jQuery工具提示(jQuery tooltip random appear)

编程入门 行业动态 更新时间:2024-10-26 00:29:07
随机出现jQuery工具提示(jQuery tooltip random appear)

我正在开发这个“徽标颜色”。 我需要工具提示出现在DIV中,其中id是#show点击后(这是正常的)。 但是在悬停按钮后,工具提示会出现在任何想要的位置。

请访问我的问题: 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()); }); });

I am developing this "logo colors". I need the tooltip to appear in a DIV where id is #show after I click (this is OK). But after hover the buttons the tooltip is appearing anywhere it wants.

Visit my problem here: 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 。 只需将其添加到文档中,一切都会好的!!

你可以从这里得到它

UPDATE

如果你在div中需要它,还有html添加title属性,如下所示从其他元素中删除title属性

$('#show').html($('#' + $(this).attr('aria-describedby')).children().html()); $('#show').attr('title',$('#' + $(this).attr('aria-describedby')).children().html()); //add this

You have not included jquery-ui.css. Just add it in document and everything will be fine!!

You can get it from here

UPDATE

If you need it in the div the along with html add title attribute too and as below remove the title attribute from other elements

$('#show').html($('#' + $(this).attr('aria-describedby')).children().html()); $('#show').attr('title',$('#' + $(this).attr('aria-describedby')).children().html()); //add this

更多推荐

本文发布于:2023-04-28 02:46:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1329831.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:提示   工具   jQuery   tooltip   random

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!