当前位置:网站首页>tooltips使用教程(鼠标悬停时显示提示)
tooltips使用教程(鼠标悬停时显示提示)
2022-07-31 15:33:00 【滕青山YYDS】
效果
希望鼠标悬停时给出提示,如图:
实战
我们这里使用Bootstrap中的tooltips来实现。
引入css和js文件
引入bootstrap css文件
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">引入js
<script src="js/jquery-2.1.1.min.js"></script> <script src="js/popper.min.js"></script> <script src="js/bootstrap.min.js"></script>
文件下载地址依次为:
https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css
https://code.jquery.com/jquery-3.3.1.slim.min.js
https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js
https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js
使用
在html文件加上下面这块代码
<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Tooltip on top">
Tooltip on top
</button>
重点是data-toggle和data-placement这两个属性。
最后通过下面这块js代码来启用提示:
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
可以看到js代码中是通过data-toggle属性来选择元素进行展示提示文本的,而data-placement属性用于设置提示文本的位置,如top\bottom\left\right。
文档
边栏推荐
- 使用 GraphiQL 可视化 GraphQL 架构
- Visualize GraphQL schemas with GraphiQL
- 【Meetup预告】OpenMLDB+OneFlow:链接特征工程到模型训练,加速机器学习模型开发
- 数据表插入数据insert into
- 三、数组
- DBeaver连接MySQL 8.x时Public Key Retrieval is not allowed 错误解决
- Codeforces Round #796 (Div. 2) (A-D)
- Why is the field of hacking almost filled with boys?
- TRACE32——C源码关联
- 01 邂逅typescript,环境搭建
猜你喜欢

RecyclerView的高效使用第一节

Kubernetes principle analysis and practical application manual, too complete

Efficient use of RecyclerView Section 1

Ubantu专题4:xshell、xftp连接接虚拟机以及设置xshell复制粘贴快捷键

基于ABP实现DDD

Ubantu project 4: xshell, XFTP connected the virtual machine and set xshell copy and paste the shortcut

工程流体力学复习

使用 GraphiQL 可视化 GraphQL 架构

【Meetup预告】OpenMLDB+OneFlow:链接特征工程到模型训练,加速机器学习模型开发

工程水文学复习资料
随机推荐
贪吃蛇项目(简单)
R language test whether the sample conforms to normality (test whether the sample comes from a normally distributed population): shapiro.test function tests whether the sample conforms to the normal d
QGIS 加载WMS数据,重新投影
mysql黑窗口~建库建表
【Meetup预告】OpenMLDB+OneFlow:链接特征工程到模型训练,加速机器学习模型开发
How does automated testing create business value?
7. Summary of common interview questions
R语言ggplot2可视化:使用ggpubr包的ggboxplot函数可视化分组箱图、使用ggpar函数改变图形化参数(legend、修改可视化图像的图例在整图中的位置)
Use of radiobutton
Vb how to connect mysql_vb how to connect to the database collection "advice"
update data table update
WPF项目--控件入门基础用法,必知必会XAML
工程水文学名词解释总结
双边滤波加速「建议收藏」
浏览器自带的拾色器
Emmet syntax
删除表格数据或清空表格
R语言ggplot2可视化:使用ggpubr包的ggboxplot函数可视化分组箱图、使用ggpar函数改变图形化参数(caption、添加、修改可视化图像的题注、脚注内容)
The use of button controls
Visualize GraphQL schemas with GraphiQL