支持换行的 JQuery 工具提示 [英] JQuery tooltip that supports new line

查看:21
本文介绍了支持换行的 JQuery 工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个轻量级的 jquery 插件,用于在用户将鼠标悬停在元素上时显示工具提示.我希望插件从 title 属性中获取内容,而且我可以换行很重要.

I'm looking for a lightweight jquery plugin for displaying tooltips when the user hovers over an element. I would like the plugin to get the content from the title attribute and also it's important that I can make new lines.

感谢任何帮助!

推荐答案

我通常使用 tipsy.

您可以在 Tipsy 中添加任何 html 元素,因此 <br/> 有效.

You can add any html element in tipsy, so <br/> works.

您只需要像这样传递 html 选项:

You just need to pass the html option as such :

$('#example-html').tipsy({html: true });

如果您不想使用 title 属性来显示 html(在这种情况下不会验证),您可以使用 fallback 选项.

If you don't want to use the title attribute to display html (it won't validate in this case), you can use the fallback option.

$('#example-fallback').tipsy({fallback: "Where's my tooltip yo'? <br/> yay !" });

醉酒网页上的更多选项和示例.

这篇关于支持换行的 JQuery 工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆