AngularJS中的自定义工具提示
Custom tooltip in AngularJS
我用这段代码在AngularJS中制作了工具提示。我想更改工具提示的背景。我不想要我的工具提示内容的黑色背景。我也想改变工具提示的形状。如何做到这一点?我尝试了一些css代码,但没有给出理想的结果。
var app = angular.module('plunker', ['ui.bootstrap']);
app.controller('MainCtrl', function($scope) {
});
.round-button {
display:block;
width:50px;
height:50px;
line-height:50px;
border: 2px solid #f5f5f5;
border-radius: 50%;
color:#f5f5f5;
text-align:center;
text-decoration:none;
background: #ff9900;
box-shadow: 0 0 3px gray;
font-size:20px;
font-weight:bold;
}
.round-button:hover {
background: #cccc00
;
}
.zoomInInfinite {
animation: zoomInInfinitef 1s;
-webkit-animation: zoomInInfinitef 1s infinite;
-moz-animation: zoomInInfinitef 1s infinite;
}
@keyframes zoomInInfinitef {
from {
opacity: 0;
transform: scale3d(.3, .3, .3);
}
50% {
opacity: 1;
}
}
@-webkit-keyframes zoomInInfinitef {
from {
opacity: 0;
-moz-transform: scale3d(.3, .3, .3);
-webkit-transform: scale3d(.3, .3, .3);
}
50% {
opacity: 1;
}
}
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<!-- Styles -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- Scripts -->
<script src="https://code.angularjs.org/1.2.20/angular.js"></script>
<!-- <script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.11.0.js"></script>-->
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.12.0.js"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<div class="container text-center">
<button type="button" class="round-button zoomInInfinite"
data-toggle="tooltip"
tooltip="this is my tooltip"
tooltip-placement="right" >
</button>
</div>
</body>
</html>
要使用tooltip-class
并自定义工具提示,您需要将ui-bootstrap-tpls
更新到13.0版本以上。
请按照链接并比较版本0.12和0.13 的工具提示文档
以下是定制的JSFiddle示例
从技术上讲,工具提示指令允许您从类开始设置几乎任何内容,甚至可以设置自己的模板。请参阅文档:https://angular-ui.github.io/bootstrap/#/tooltip.
例如,一旦你设置了你的类,你就非常欢迎为它定义任何你想要的东西。但是,我不建议重写引导程序提供的类的定义。你会给自己制造更多的问题。
相关文章:
- MVC中关于表的自定义工具提示-每行显示数据
- 图表.js - 具有多个值的自定义工具提示
- 用于动态引导工具提示的自定义KnockoutJS绑定处理程序
- jquery UI工具提示的自定义背景图像
- AngularJS中的自定义工具提示
- FancyBox和自定义工具提示一起使用不起作用
- 如何在堆栈中创建具有不同颜色和自定义工具提示的堆积柱形图
- KendoUI堆叠条形图自定义工具提示
- 将图表工具提示自定义为标签,其中线条指向饼图段
- 如何将自定义工具提示添加到 jqxwidget 部分饼图系列
- 自定义工具提示的基本思想,使用纯Javascript
- 如何使用人力车库在折线图上显示自定义工具提示
- UIB 工具提示自定义触发器不起作用
- jQuery 工具提示中的自定义 jQuery 滚动条
- 在我的自定义指令中动态添加 bootstrap.ui 工具提示
- 按钮点击功能不适用于数据表工具栏自定义按钮
- 为什么内部工具提示“未定义”?
- 酒窝系列工具提示自定义
- 共享点 2013 中的工具提示自定义
- 高图工具提示自定义