当前位置:网站首页>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。
文档
边栏推荐
- 11 pinia use
- Vb how to connect mysql_vb how to connect to the database collection "advice"
- WPF project - basic usage of controls entry, you must know XAML
- 01 Encounter typescript, build environment
- Delete table data or clear table
- Matlab matrix basic operations (definition, operation)
- AVH Deployment Practice (1) | Deploying the Flying Paddle Model on Arm Virtual Hardware
- 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
- RecyclerView高效使用第二节
- mysql black window ~ build database and build table
猜你喜欢
随机推荐
6-22漏洞利用-postgresql数据库密码破解
R language ggplot2 visualization: use the ggboxplot function of the ggpubr package to visualize the box plot, use the font function to customize the font size, color, style (bold, italic) of the legen
为什么黑客领域几乎一片男生?
删除 状态良好(恢复分区)的磁盘
Deployment application life cycle and Pod health check
Ubuntu Topic 5: Setting a Static IP Address
Qt实战案例(54)——利用QPixmap设计图片透明度
力扣:56. 合并区间
为什么毕业季不要表白?
Linux查看redis版本(查看mongodb版本)
数据表插入数据insert into
ML.NET相关资源整理
Delete the disk in good condition (recovery partition)
Emmet 语法
7. Summary of common interview questions
国内市场上的BI软件,到底有啥区别
四象限时间管理有多好用?
Getting Started with TextBlock Control Basic Tools Usage, Get Started
Kubernetes常用命令
腾讯云部署----DevOps









