在 angularjs 中单击时制作工具提示
Making tooltip on click in angularjs
我正在努力制作点击 angularjs 中的工具提示。
这是我现在拥有的,它仍在悬停:
JS模块:
.config(['$uibTooltipProvider', function($uibTooltipProvider){
$uibTooltipProvider.setTriggers({
'click': 'click',
});
$uibTooltipProvider.options({
'placement': 'right'
});
}])
(我认为模块设置正确,因为放置部分工作并对 JS 文件中的更改做出反应)。
HTML:
<div>
<i class="fa fa-info-circle fa-lg" style="color:#26a6d1"
uib-tooltip="tooltip text" tooltip-placement="right"
tooltip-trigger="click"
>
</i>
</div>
CSS:
.tooltip > .tooltip-arrow {
visibility: visible;
border-right-color: #26a6d1;
}
.tooltip > .tooltip-inner {
visibility: visible;
border: 2px solid #26a6d1;
background-color:white;
font-weight: normal;
color: black;
}
.tooltip {
visibility: visible;
position: relative;
display: inline-block;
}
.tooltip .tooltiptext {
visibility: hidden;
border: 2px solid #26a6d1;
width: 120px;
background-color: white;
color: black;
text-align: center;
padding: 5px 0;
border-radius: 6px;
position: absolute;
}
.tooltip:hover .tooltiptext { //this part is for another tooltip (simple one, working on hove)
visibility: visible;
}
和bower.json:
{
"name": "whatever",
"private": true,
"dependencies": {
"angular": "1.5.8",
"angular-messages": "1.5.8",
"angular-sanitize": "1.5.8",
"angular-animate": "1.5.8",
"angular-recaptcha": "2.5.0",
"angular-ui-router": "0.2.18",
"angular-selectize2": "3.0.1",
"moment-picker": "0.5.6",
"angular-scroll": "1.0.0",
"angular-flash-alert": "2.3.0",
"angular-translate": "2.11.1",
"angular-elastic": "2.5.1",
"angular-tooltips": "1.1.6",
"jquery": "2.2.0",
"accounting.js": "0.4.1",
"moment": "2.14.1",
"moment-timezone": "0.5.5",
"ng-dialog": "0.6.2",
"es6-shim": "0.35.0",
"angular-bootstrap": "latest",
"bootstrap": "3.3.5"
},
"resolutions": {
"angular": "1.5.8",
"moment": "2.14.1",
"moment-timezone": "0.5.5"
},
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"overrides": {
"moment": {
"main": [
"min/moment.min.js",
"locale/lt.js"
]
}
},
"devDependencies": {
"angular-bootstrap": "^2.5.0"
}
}
我尝试更新 bootstrap,更改 html 的部分内容,但似乎没有任何效果。
<div>
<i class="fa fa-info-circle fa-lg" style="color:#26a6d1"
uib-tooltip="tooltip text" tooltip-placement="right"
tooltip-trigger="'click'"
>
</i>
</div>
属性值 click 应该在引号下面:tooltip-trigger="'click'"
我正在努力制作点击 angularjs 中的工具提示。
这是我现在拥有的,它仍在悬停:
JS模块:
.config(['$uibTooltipProvider', function($uibTooltipProvider){
$uibTooltipProvider.setTriggers({
'click': 'click',
});
$uibTooltipProvider.options({
'placement': 'right'
});
}])
(我认为模块设置正确,因为放置部分工作并对 JS 文件中的更改做出反应)。
HTML:
<div>
<i class="fa fa-info-circle fa-lg" style="color:#26a6d1"
uib-tooltip="tooltip text" tooltip-placement="right"
tooltip-trigger="click"
>
</i>
</div>
CSS:
.tooltip > .tooltip-arrow {
visibility: visible;
border-right-color: #26a6d1;
}
.tooltip > .tooltip-inner {
visibility: visible;
border: 2px solid #26a6d1;
background-color:white;
font-weight: normal;
color: black;
}
.tooltip {
visibility: visible;
position: relative;
display: inline-block;
}
.tooltip .tooltiptext {
visibility: hidden;
border: 2px solid #26a6d1;
width: 120px;
background-color: white;
color: black;
text-align: center;
padding: 5px 0;
border-radius: 6px;
position: absolute;
}
.tooltip:hover .tooltiptext { //this part is for another tooltip (simple one, working on hove)
visibility: visible;
}
和bower.json:
{
"name": "whatever",
"private": true,
"dependencies": {
"angular": "1.5.8",
"angular-messages": "1.5.8",
"angular-sanitize": "1.5.8",
"angular-animate": "1.5.8",
"angular-recaptcha": "2.5.0",
"angular-ui-router": "0.2.18",
"angular-selectize2": "3.0.1",
"moment-picker": "0.5.6",
"angular-scroll": "1.0.0",
"angular-flash-alert": "2.3.0",
"angular-translate": "2.11.1",
"angular-elastic": "2.5.1",
"angular-tooltips": "1.1.6",
"jquery": "2.2.0",
"accounting.js": "0.4.1",
"moment": "2.14.1",
"moment-timezone": "0.5.5",
"ng-dialog": "0.6.2",
"es6-shim": "0.35.0",
"angular-bootstrap": "latest",
"bootstrap": "3.3.5"
},
"resolutions": {
"angular": "1.5.8",
"moment": "2.14.1",
"moment-timezone": "0.5.5"
},
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"overrides": {
"moment": {
"main": [
"min/moment.min.js",
"locale/lt.js"
]
}
},
"devDependencies": {
"angular-bootstrap": "^2.5.0"
}
}
我尝试更新 bootstrap,更改 html 的部分内容,但似乎没有任何效果。
<div>
<i class="fa fa-info-circle fa-lg" style="color:#26a6d1"
uib-tooltip="tooltip text" tooltip-placement="right"
tooltip-trigger="'click'"
>
</i>
</div>
属性值 click 应该在引号下面:tooltip-trigger="'click'"