CSS&&Bootstrap:tooltips的简单应用

1.

对于普通的Element,首先在class里面添加一个atip类

并且添加对应的值

data-toggle不可变

data-placement可以设置为top | bottom | left | right | auto.

title不为空的情况会显示title

否则显示data-original-title

2.

当然最基本的文件都要导入

然后写一个JS脚本就可以了

Trigger:How tooltip is triggered - click | hover | focus | manual.

其他属性参考对应API

Name Type Default Description
animation boolean true Apply a CSS fade transition to the tooltip
container string | false false
Appends the tooltip to a specific element. Example: container: ‘body‘. This option is particularly
useful in that it allows you to position the tooltip in the flow of the document near the triggering element - which will prevent the tooltip from floating away from the triggering element during a window resize.

delay number | object 0
Delay showing and hiding the tooltip (ms) - does not apply to manual trigger type

If a number is supplied, delay is applied to both hide/show

Object structure is: delay: { "show": 500, "hide": 100 }

html boolean false Insert HTML into the tooltip. If false, jQuery‘s text method will be used to insert content
into the DOM. Use text if you‘re worried about XSS attacks.
placement string | function ‘top‘
How to position the tooltip - top | bottom | left | right | auto.

When "auto" is specified, it will dynamically reorient the tooltip. For example, if placement is "auto left", the tooltip will display to the left when possible, otherwise it will display right.

When a function is used to determine the placement, it is called with the tooltip DOM node as its first argument and the triggering element DOM node as its second. Thethis context
is set to the tooltip instance.

selector string false If a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to enable dynamic HTML content to have tooltips added. Seethisandan
informative example
.
template string ‘<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>‘
Base HTML to use when creating the tooltip.

The tooltip‘stitle will be injected into the .tooltip-inner.

.tooltip-arrow will become the tooltip‘s arrow.

The outermost wrapper element should have the .tooltip class.

title string | function ‘‘
Default title value if title attribute isn‘t present.

If a function is given, it will be called with its this reference set to the element that
the tooltip is attached to.

trigger string ‘hover focus‘ How tooltip is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space.
viewport string | object { selector: ‘body‘, padding: 0 }
Keeps the tooltip within the bounds of this element. Example: viewport: ‘#viewport‘ or {
"selector": "#viewport", "padding": 0 }

时间: 2024-08-07 17:00:04

CSS&&Bootstrap:tooltips的简单应用的相关文章

bootstrap-dialog简单使用

使用bootstrap想要实现弹出对话框的效果,我们可以使用bootstrap的modal.但是modal使用起来比较繁琐,需要编写大量的div代码.bootstrap-dialog很好的解决了这个问题. bootstrap-dialog的gitlhub地址 bootstrap-dialog参考案例 使用boostrap-dialog非常简单, 首先,引入boostrap-dialog.js和bootstrap-dialog.css文件 然后,简单的一句就可以搞定了. BootstrapDial

[bootstrap] 打造一个简单的系统模板(1) 左侧折叠菜单

1. 前言 最近需要做一个后台管理系统,我打算使用bootstrap弄一个好看的后台模板.网上的好多模板我觉的css和js有点重. 于是就打算完全依靠bootstrap搭建一个属于自己的模板. 首先从左侧的折叠菜单开始.看图. 2. CSS 代码 以下是自定义的css代码,由于系统是内部使用,所以优先考虑chrome,firefox 不考虑IE了. #main-nav { margin-left: 1px; } #main-nav.nav-tabs.nav-stacked > li > a {

对bootstrap modal的简单扩展封装

对bootstrap modal的简单扩展封装 参考自:http://www.muzilei.com/archives/677   注:原文不支持bootstrap新版本,并且居中等存在问题 此段时间一直在学习bootstrap,主要是用于做后台,一直习惯用easyui,ui,jgrid前端框架,以至于并不习惯bootstrap的风格.近来考虑到easyui性能不太好,就用了bootstrap,先说下我所了解的bootstrap. 1.外国的框架用于显示中文看着总是不妥. 2.默认的样式觉得有些

webUI框架miniUI,easyUI,extJS,Bootstrap简介及简单部署

本文为大家讲解的是webUI框架miniUI,easyUI,extJS,Bootstrap简介及简单部属,感兴趣的同学参考下 ExtJS是一种主要用于创建前端用户界面,是一个基本与后台技术无关的前端ajax框架. jQuery EasyUI是一组基于jQuery的UI插件集合,而jQuery EasyUI的目标就是帮助web开发者更轻松的打造出功能丰富并且美观的UI界面.开发者不需要编写复杂的javascript,也不需要对css样式有深入的了解,开发者需要了解的只有一些简单的html标签. B

bootstrap的模态简单案例

使用时需添加bootstrap的引用,否则实现不出来效果 <!DOCTYPE html> <html><head>    <meta name="viewport" content="width=device-width" />    <title>Index</title> 注意此处的引用顺序 <link href="~/css/bootstrap.min.css"

57-005-3 bootstrap实现一个简单的项目案例--新闻操作(基于jsp无刷新异步操作)

图文版页面:http://note.youdao.com/share/?id=fc2d42d8ce97bea6f3272c02e92a2d23&type=note 资源文件下载:https://yunpan.cn/OcRdu34JqpRdtw 访问密码 67af 3.1 本项目的将按照企业标准开发流程,将程序分成几个层次,同时使用mysql数据库,IDEA开发工具 3.2 本程序主要是对新闻数据(编号.标题.发布日期.内容)的一个维护,具体要求: a. 业务层--增加新闻数据 数据层--新闻表中

python web框架企业实战详解(第六期)\第三课时-css&amp;bootstrap

raw css: <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style type="text/css"> p.ex1 { font:italic arial,sans-serif; } p.ex2 { font:italic bold 12px/3

用bootstrap写一个简单的静态网页

先说点题外话,如果想直接进入bootstrap正题请从第二段开始.周五面试一个小公司,给了我一个psd图让我用最快的时间还愿出这个静态页面,要求是能保证兼容性以及web响应式各种屏幕正常显示.周五晚上开始着手做到了凌晨,然后周六睡了一天的觉补回来,发现现在精力真不比大学毕业.周天放松了一天,炉石新版本巫妖王的骑士刚开,必须玩一下.TI7newbee输了.中国新歌声这届真的不行.中国有嘻哈到目前为止最喜欢小青龙的才气(可惜声音一般),希望带来更多好听的歌,PGone应该是夺冠热门,现场气氛被带动到

No mapping found for HTTP request with URI [/crmcrmcrm/css/bootstrap.min.css] in DispatcherServlet with name &#39;springMvc&#39;

先把错误贴上来 No mapping found for HTTP request with URI [/crmcrmcrm/css/sb-admin-2.css] in DispatcherServlet with name 'springMvc'DEBUG [http-bio-8080-exec-6] - Successfully completed requestDEBUG [http-bio-8080-exec-7] - Did not find handler method for [