类似Facebook jQuery工具提示插件 Tipsy

  • 源码大小:9.12KB
  • 所需积分:1积分
  • 源码编号:19JP-3557
  • 浏览次数:1025次
  • 最后更新:2023年06月26日
  • 所属栏目:工具提示
本站默认解压密码:19jp.com 或 19jp_com

简介

tipsy是一个简单的jQuery工具提示插件,用于根据元素的标题属性

Twitter、Github、Slideshare和Bitbucket等都在使用它。

特征:

  • 从任何属性中提取内容。
  • 淡入/淡出动画。
  • 支持HTML内容。
  • 自定义触发器事件。不仅仅是“悬停”。
  • 自定义位置。

如何使用它:

1.在文档中加载jQuery库和jQuery Tipsy插件的文件。

  1. <link href="src/stylesheets/tipsy.css" rel="stylesheet" />
  2. <script src="/path/to/cdn/jquery.min.js"></script>
  3. <script src="src/javascripts/jquery.tipsy.js"></script>

2.调用目标元素上的函数,并在标题属性就是这样。

  1. <button title="Tooltip Here" rel="tipsy">
  2. Hover Me
  3. </button>
  1. $(function() {
  2. $('button[rel=tipsy]').tipsy({
  3. // options here
  4. });
  5. });

3.使用以下选项自定义工具提示

  1. $('button[rel=tipsy]').tipsy({
  2.  
  3. // additional CSS classes
  4. className: null,
  5. // delay in ms
  6. delayIn: 0,
  7. delayOut: 0,
  8.  
  9. // enable fade animation
  10. fade: false,
  11.  
  12. // fallback
  13. fallback: '',
  14.  
  15. // n, s, e, w, nw, ne, sw, se
  16. // north, south, east, west
  17. gravity: 'n',
  18.  
  19. // allows HTML content
  20. html: false,
  21.  
  22. // offset in px
  23. offset: 0,
  24.  
  25. // opacity level
  26. opacity: 0.8,
  27.  
  28. // extract tooltip content from this attribute
  29. title: 'title',
  30.  
  31. // trigger event
  32. trigger: 'hover'
  33.  
  34. });

参见:

  • 使用JavaScript和纯CSS的10个最佳工具提示插件

更新日志:

2022-05-25

  • 固定演示
  • 固定下载链接
  • 更新的文档

预览截图