html5 tooltips,纯js轻量级tooltips工具提示插件

html5tooltipsjs是一款使用纯javacript编写的轻量级tooltips工具提示插件。该tooltips插件不依赖任何框架,内容可带HTML标签,并可以使用预设的CSS3动画来制作tooltips动画效果。

使用方法

基本使用方法

最简单的在某个元素上显示tooltips的方法是在这个元素上添加data-*属性。

高级使用方法

你也可以通过JavaScript来调用该tooltips插件。

html5tooltips({

contentText: "Refresh",

targetSelector: "#refresh"

});

你可以指定tooltips在元素的什么方向上出现。

html5tooltips({

contentText: "Refresh",

stickTo: "right",

targetSelector: "#refresh"

});

你还可以在tooltips中添加额外的说明文本。这些文本会在元素聚焦时显示。这个特性用于在输入框或可编辑字段中使用。你可以使用HTML标签。

html5tooltips({

contentText: "Not less then 8 symbols",

contentMore: "Use lower and UPPER case letters,

num6ers and

spec!al symbols

to make password safe and secure.",

maxWidth: "180px",

targetSelector: "#password"

});

你可以定义多个tooltips,每个tooltips在参数数组中作为一个对象。

html5tooltips([

{

contentText: "Delete",

targetSelector: "#delete"

},

{

contentText: "Refresh",

stickTo: "top",

targetSelector: "#refresh"

},

{

contentText: "Simple to remember",

contentMore: "Check that your login name is not used by anyone else.",

stickTo: "left",

maxWidth: "180px",

targetSelector: "#username"

}

]);

配置参数

animateFunction:tooltips可用的CSS3动画类型。可用的动画有:fadein,foldin,foldout,roll,scalein,slidein,spin。

color:tooltips可用的预定义颜色。可用值有:daffodil, daisy, mustard, citrus-zest, pumpkin, tangerine, salmon, persimmon, rouge, scarlet, hot-pink, princess, petal, lilac, lavender, violet, cloud, dream, gulf, turquoise, indigo, navy, sea-foam, teal, peacock, ceadon, olive, bamboo, grass, kelly, forrest, chocolate, terra-cotta, camel, linen, stone, smoke, steel, slate, charcoal, black, white, metalic-silver, metalic-gold, metalic-copper,或者任何CSS颜色。

contentText:tooltip的内容,可以是HTML标签。

contentMore:tooltip中显示的更多内容,会在元素聚焦时显示。

disableAnimation:是否禁用动画。

stickTo:tooltip显示的位置。可用值有bottom,left,right和top。

stickDistance:tooltip和目标元素之间的距离,单位像素。

targetSelector:目标元素的CSS选择器。

targetXPath:目标元素的xPath值。

maxWidth:tooltip的扩展文本的最大宽度。

可用的data-*属性

data-tooltip:与contentText参数相同。

data-tooltip-animate-function:与animateFunction参数相同。

data-tooltip-color:与color参数相同。

data-tooltip-more:与contentMore参数相同。

data-tooltip-stickto:与stickTo参数相同。

data-tooltip-maxwidth:与maxWidth参数相同。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值