# @fengyuanchen/tooltip 中文文档

规范地址：https://npmcn.com/package/%40fengyuanchen/tooltip/

版本：0\.0\.2
npm 元数据更新时间：2022-06-12T17:53:01.476Z
中文译文更新时间：2026-11-14T14:29:46.767Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40fengyuanchen/tooltip
原文对照：https://npmcn.com/package/%40fengyuanchen/tooltip/?lang=original
项目主页：https://github.com/fengyuanchen/tooltip
源码仓库：https://github.com/fengyuanchen/tooltip

弃用说明：No longer maintainted\.

## 关键信息（来自 npm 元数据）

- 模块格式：CommonJS
- TypeScript 类型：未声明
- 运行依赖：1 个
- 首次发布：2015-08-09T09:47:32.210Z
- 最新版本发布：2015-08-09T09:47:32.210Z
- 近 30 天下载量：22128（2026-10-15 至 2026-11-13，npm 官方下载统计）
- 已发布版本数：1（近 12 个月 0 个）

## 中文简介

一个简单的 j 查询工具提示插件 .

## 安装

```sh
npm install @fengyuanchen/tooltip
```

也可以使用：`pnpm add @fengyuanchen/tooltip`、`yarn add @fengyuanchen/tooltip`、`bun add @fengyuanchen/tooltip`

## README

# [工具提示](https://github.com/fengyuanchen/tooltip)

> 一个简单的 j 查询工具提示插件 .

-   [演示](http://fengyuanchen.github.io/tooltip)

## 主要

```
dist/
├── tooltip.css     (2 KB)
├── tooltip.min.css (2 KB)
├── tooltip.js      (9 KB)
└── tooltip.min.js  (4 KB)
```

## 开始

### 快开始

有三个快速启动选项:

-   [下载最新版本](https://github.com/fengyuanchen/tooltip/archive/master.zip)。 。 。 .
-   清除仓库 : `git clone https://github.com/fengyuanchen/tooltip.git`。 。 。 .
-   安装方式 [国家预防机制](http://npmjs.org/)数字 : `npm install @fengyuanchen/tooltip`。 。 。 .

### 安装

包含文件 :

```html
<script src="/path/to/jquery.js"></script><!-- jQuery is required -->
<link  href="/path/to/tooltip.css" rel="stylesheet">
<script src="/path/to/tooltip.js"></script>
```

### 使用量

初始化为 `$.fn.tooltip` 方法.

```js
// With option
$('body').tooltip({
  autoshow: true,
  content: 'Hello, world!'
});

// With method
$('body').tooltip('show', 'Hello, world!');

// Shortcut
$('body').tooltip('Hello, world!');
```

## 选项

```js
// Set tooltip options
$().tooltip(options);

// Change the global default options
$.fn.tooltip.setDefaults(options);
```

### 自动隐藏

-   类型 : `Boolean`
-   默认 : `true`

超时时自动隐藏工具提示 。 需求 `duration` 选项待设定.

### 自动显示

-   类型 : `Boolean`
-   默认 : `true`

初始化时自动显示工具提示 。 需求 `content` 选项待设定.

### 内容

-   类型 : `String`
-   默认 : `''`

工具提示内容

### 倒计时

-   类型 : `Boolean`
-   默认 : `false`

显示倒计时视图 。 需求 `duration` 选项待设定.

### 可驳回

-   类型 : `Boolean`
-   默认 : `false`

允许在工具提示自动关闭前点击所附带的关闭按钮,以删除该提示.

### 会期

-   类型 : `Number`
-   默认 : `3000`

定义工具提示显示的时间( 默认为3秒) .

### 已固定

-   类型 : `Boolean`
-   默认 : `true`

修正工具提示( 仅可用于 `body` 页:1.

### 页:1

-   类型 : `Number`
-   默认 : `10`

将工具提示从其父中抵消 .

### 职位

-   类型 : `String`
-   默认 : `'center top'`
-   选项 : `'left top'`, (中文(简体) ), `'center top'`, (中文(简体) ), `'right top'`, (中文(简体) ), `'left middle'`, (中文(简体) ), `'center middle'`, (中文(简体) ), `'right middle'`, (中文(简体) ), `'left bottom'`, (中文(简体) ), `'center bottom'`, (中文(简体) ), `'right bottom'`

工具提示的位置(水平和垂直)

### 样式

-   类型 : `String`
-   默认 : `'default'`
-   选项 : `'default'`, (中文(简体) ), `'primary'`, (中文(简体) ), `'success'`, (中文(简体) ), `'info'`, (中文(简体) ), `'warning'`, (中文(简体) ), `'danger'`

工具提示的样式

### zindex 数据

-   类型 : `Number`
-   默认 : `1024`

工具提示的Z指数.

## 方法

```js
$().tooltip('method', argument1, , argument2, ..., argumentN)
```

### 显示(\[内容\[,选项\]\]\])

-   **内容** (可选) :
    -   类型 : `String`
    -   工具提示 [内容](https://npmcn.com/package/%40fengyuanchen/tooltip/#readme-content)
-   **选项** (可选) :
    -   类型 : `String` 或者说 `Object`
    -   工具提示 [样式](https://npmcn.com/package/%40fengyuanchen/tooltip/#readme-style) 或工具提示的 [选项](https://npmcn.com/package/%40fengyuanchen/tooltip/#readme-options)

用新内容显示工具提示 .

```js
$().tooltip('show', 'Hello, world!');
$().tooltip('show', 'Hello, world!', 'primary');
$().tooltip('show', 'Hello, world!', {
  style: 'primary',
  zIndex: 2048
});
```

**快捷键 :** `$().tooltip(content, options)`

-   仅限 `show` 方法
-   第一个参数必须是字符串(不是方法之一)

```js
$().tooltip('Hello, world!', 'primary');
```

### 隐藏( c)

隐藏工具提示 .

### 销毁()

摧毁工具提示.

## 活动

### 显示.工具提示

这个事件在 `show` 使用实例方法.

### 显示. tabletip

当工具提示被显示给用户时(将等待 CSS 转换完成),此事件会被点燃.

### 隐藏. 工具提示

当隐藏实例方法被调用时,此事件立即被发射.

### 隐藏. 工具提示

当工具提示从用户处被隐藏完成时( 将等待 CSS 转换完成) , 此事件会被启动 .

## 无冲突

如果您需要使用同一命名空间的其他插件, 请打电话到 `$.fn.tooltip.noConflict` 重新使用的方法.

```html
<script src="other-plugin.js"></script>
<script src="tooltip.js"></script>
<script>
  $.fn.tooltip.noConflict();
  // Code that uses other plugin's "$().tooltip" can follow here.
</script>
```

## 浏览器支持

-   铬(最新2份)
-   火狐(最新2个)
-   互联网探索者 8+
-   歌剧院(最新2个)
-   萨法里(最新2份)

作为 jQuery 插件,您还需要查看 [j 查询浏览器支持](http://jquery.com/browser-support/)。 。 。 .

## [许可证](https://npmcn.com/package/%40fengyuanchen/tooltip/LICENSE.md)

释放 [麻省理工学院](http://opensource.org/licenses/mit-license.html) 执照.

## 常见问题

### @fengyuanchen/tooltip 是什么？

一个简单的 j 查询工具提示插件 \.注意：该包已被作者标记为弃用——No longer maintainted\.

### 如何安装 @fengyuanchen/tooltip？

在项目目录运行 npm install @fengyuanchen/tooltip，或使用 pnpm add / yarn add / bun add。

### @fengyuanchen/tooltip 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/fengyuanchen\_\_tooltip 是否存在。

### @fengyuanchen/tooltip 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @fengyuanchen/tooltip 可以商用吗？

@fengyuanchen/tooltip 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @fengyuanchen/tooltip 的下载量有多少？

根据 npm 官方下载统计，@fengyuanchen/tooltip 在 2026/10/15 – 2026/11/13 这 30 天内被下载 22,128 次，日均约 738 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @fengyuanchen/tooltip 还在维护吗？

最新版本 0\.0\.2 发布于 2015/08/09（11 年前）；至今共发布 1 个版本，其中过去 12 个月发布了 0 个；首次发布于 2015/08/09。作者已将其标记为弃用，新项目建议寻找替代方案。

