javascript - qtip 隐藏特定元素的工具提示
问题描述
我有一张带有 qtip 工具提示插件的表格。我想在表格的操作列中隐藏提示。尝试隐藏目标选项
hide: {
target: $('h1:first')
}
但这不是我需要的
<table>
<thead>
<th>name</th>
<th>telephone</th>
<th>mobile</th>
<th>action</th>
</thead>
<tbody>
<tr data-tooltip="My tooltip text">
<td>John</td>
<th>3242123</th>
<th>856966633325</th>
<th><a href="#">edit</a></th>
</tr>
<tr data-tooltip="My tooltip text2">
<td>Sarah</td>
<th>5436346</th>
<th>3543435345</th>
<th><a href="#">edit</a></th>
</tr>
</tbody>
</table>
js代码:
$('[data-tooltip!=""]').qtip({
content: {
attr: 'data-tooltip' // Tell qTip2 to look inside this attr for its content
},
show: {
delay: 1000
},
hide: {
fixed: true,
},
position: {
target: 'mouse', // Use the mouse position as the position origin
adjust: {
// Don't adjust continuously the mouse, just use initial position
mouse: false
}
},
});
我不知道如何在除了操作列之外的几乎所有部分中显示它
现场版:jsfiddle
解决方案
将data-tooltip
属性移动到td
而不是tr
. 并仅将其添加到td
您需要显示工具提示的那些中。更新html
将如下所示。
这是更新的JSFiddle
<table>
<thead>
<th>name</th>
<th>telephone</th>
<th>mobile</th>
<th>action</th>
</thead>
<tbody>
<tr>
<td data-tooltip="My tooltip text">John</td>
<th data-tooltip="My tooltip text">3242123</th>
<th data-tooltip="My tooltip text">856966633325</th>
<th><a href="#">edit</a></th>
</tr>
<tr>
<td data-tooltip="My tooltip text2">Sarah</td>
<th data-tooltip="My tooltip text2">5436346</th>
<th data-tooltip="My tooltip text2">3543435345</th>
<th><a href="#">edit</a></th>
</tr>
</tbody>
</table>
推荐阅读
- minizinc - MiniZinc:类型错误:找不到具有此签名的函数或谓词:`cost(var int,var int)'
- reactjs - 如何为 React Material UI 控件添加自定义验证?
- ios - Cordova WKWebView 仅在 iPhone 11 Pro 上出现白屏
- regex - 如何仅将 URL 的主要部分与正则表达式匹配?
- vue.js - 将鼠标悬停在 TailwindCSS 中的 div 上时显示按钮
- amazon-web-services - AWS Chime 开发工具包 - CORS 和 ERR_NAME_NOT_RESOLVED
- python - 没有使用 numpy polyfit 获得正确的值
- jquery - 使用 Bootstrap 将两个导航链接链接到一个选项卡窗格
- android - Android 房间子查询
- javascript - 反应在对象数组上查找和获取元素