用于存储数据的“标题”属性的最佳替代方法,例如单词的替代含义 [英] Best alternative to the 'title' attribute for storing data, like alternative meanings of words

查看:83
本文介绍了用于存储数据的“标题”属性的最佳替代方法,例如单词的替代含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将使用jquery来显示不是每个人都会立即知道或理解的单词的替代含义。一个非常糟糕的例子:约翰尼是个小男孩。用户可以标记一个复选框以打开现在的模式:Johnny是一个小(小,小,短)的男孩。再一次,非常简单的例子。我不想使用 title 属性,因为它会弹出那个丑陋的工具提示。有些人可能没问题,我不是。

I'm going to use jquery to show alternative meanings for words not everyone would immediately know or understand. For a really bad example: "Johnny is a little boy." A user could mark a checkbox to turn on a mode where it would now be: "Johnny is a little (tiny, small, short) boy." Again, very simple example. I don't want to use the title attribute because it pops up that little ugly tooltip. Some might be okay with that, I'm not.

最好的属性或方法是什么?创建我自己的属性?有什么好处和陷阱?

推荐答案

<span data-easy="tiny, not large" class="easy"> small </span>

使用jQuerys数据, http://api.jquery.com/jQuery.data/

use jQuerys data, http://api.jquery.com/jQuery.data/

maby使用CSS显示它们:

maby use CSS to display them:

span.makeeasy[data-easy]:after { content: " (" attr(data-easy) ")"; }

然后将内容放入DIV并添加'makeeasy'类以显示值。 (你可能需要一个旧版金砖的后备)

then put the content in a DIV and add the 'makeeasy' class to display the values. (you might need a fallback for older brwsers)

这篇关于用于存储数据的“标题”属性的最佳替代方法,例如单词的替代含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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