admin管理员组文章数量:1426292
I am searching for a Tooltip plugin/library for JQuery. It should be able to automaticlly position tooltips, like TipTip, and also support HTML content for the tips.
TipTip does fullfill both conditions, but:
Added HTML support with Tip Tip. You can now add HTML into the Title attribute (though this is not remended if you want strictly valid code).
I am searching for a Tooltip plugin/library for JQuery. It should be able to automaticlly position tooltips, like TipTip, and also support HTML content for the tips.
TipTip does fullfill both conditions, but:
Share Improve this question asked Apr 15, 2010 at 9:05 Hermine D.Hermine D. 1,1493 gold badges14 silver badges19 bronze badgesAdded HTML support with Tip Tip. You can now add HTML into the Title attribute (though this is not remended if you want strictly valid code).
4 Answers
Reset to default 1I believe this one does. For instance, this demo shows an image. You could easily have a bodyHandler
that retrieves the HTML from an attribute on the element. For instance
<a href="whatever" data-tooltip="This is a <strong>marked up</strong> tooltip">foo</a>
That's perfectly valid HTML, and the bodyHandler
would look something like
return this.attr("data-tooltip"));
I didn't want to leave jquery native plugin and mess with additional libs, so I figured out quite simple solution:
$('.tooltips').tooltip({
content: function(){
return $(this).attr('title');
}
})
This way - your title attribute with HTML may be used successfully.
I like TipTip a lot. The "title" field usage is awkward, but you don't have to do that:
content: string (false by default) - HTML or String to use as the content for TipTip. Will overwrite content from any HTML attribute.
(via http://code.drewwilson./entry/tiptip-jquery-plugin)
This tooltip widget included in the jQuery UI library supports different automatic positions and HTML in the title attribute: http://api.jqueryui./tooltip/
本文标签:
版权声明:本文标题:javascript - Is there a JQuery tooltip plugin that supports HTML content and automatically positions tooltips? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745411743a2657501.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论