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

查看:108
本文介绍了支持换行的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 .

您可以任意添加任何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天全站免登陆