Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Merge requests
!6705
Tooltips replaced when possible on edge cases
Code
Review changes
Check out branch
Download
Email patches
Plain diff
Closed
Administrator
requested to merge
github/fork/ghusse/master
into
master
12 years ago
Overview
0
Commits
2
Pipelines
0
Changes
2
Created by: ghusse
Before:
After:
0
0
Compare
master
master (base)
and
latest version
latest version
db6f777e
2 commits,
2 years ago
2 files
+
62
-
9
Expand all files
Preferences
Preferences
File browser
List view
Tree view
Compare changes
Inline
Side-by-side
Show whitespace changes
Show one file at a time
Search (e.g. *.vue) (Ctrl+P)
j
s
bootstrap-
tooltip.js
+58
-4
le
ss
toolti
p.less
+4
-5
js/bootstrap-tooltip.js
+
58
-
4
Options
View file @ db6f777e
Show full file
@@ -117,6 +117,7 @@
this
.
options
.
placement
inside
=
/in/
.
test
(
placement
)
placement
=
inside
?
placement
.
split
(
'
'
)[
1
]
:
placement
;
$tip
.
detach
()
@@ -128,7 +129,7 @@
actualWidth
=
$tip
[
0
].
offsetWidth
actualHeight
=
$tip
[
0
].
offsetHeight
switch
(
inside
?
placement
.
split
(
'
'
)[
1
]
:
placement
)
{
switch
(
placement
)
{
case
'
bottom
'
:
tp
=
{
top
:
pos
.
top
+
pos
.
height
,
left
:
pos
.
left
+
pos
.
width
/
2
-
actualWidth
/
2
}
break
@@ -143,13 +144,62 @@
break
}
$tip
.
offset
(
tp
)
this
.
applyPlacement
(
tp
,
placement
);
}
}
,
applyPlacement
:
function
(
offset
,
placement
){
var
$tip
,
$arrow
,
width
,
height
,
actualWidth
,
actualHeight
,
deltaX
,
replace
=
false
;
$tip
=
this
.
tip
();
width
=
$tip
[
0
].
offsetWidth
;
height
=
$tip
[
0
].
offsetHeight
;
$tip
.
offset
(
offset
)
.
addClass
(
placement
)
.
addClass
(
'
in
'
)
.
addClass
(
'
in
'
);
actualWidth
=
$tip
[
0
].
offsetWidth
;
actualHeight
=
$tip
[
0
].
offsetHeight
;
if
(
placement
==
"
top
"
&&
actualHeight
!=
actualWidth
){
offset
.
top
=
offset
.
top
+
height
-
actualHeight
;
replace
=
true
;
}
if
(
placement
==
"
bottom
"
||
placement
==
"
top
"
){
deltaX
=
0
;
if
(
offset
.
left
<
0
){
deltaX
=
-
offset
.
left
*
2
;
offset
.
left
=
0
;
$tip
.
offset
(
offset
);
actualWidth
=
$tip
[
0
].
offsetWidth
;
actualHeight
=
$tip
[
0
].
offsetHeight
;
}
deltaX
=
deltaX
-
width
+
actualWidth
;
$arrow
=
this
.
arrow
();
if
(
deltaX
!==
0
){
$arrow
.
css
(
"
left
"
,
50
*
(
1
-
deltaX
/
actualWidth
)
+
"
%
"
);
}
else
{
$arrow
.
css
(
"
left
"
,
""
);
}
}
if
(
replace
)
$tip
.
offset
(
offset
);
}
,
setContent
:
function
()
{
var
$tip
=
this
.
tip
()
,
title
=
this
.
getTitle
()
@@ -215,6 +265,10 @@
return
this
.
$tip
=
this
.
$tip
||
$
(
this
.
options
.
template
)
}
,
arrow
:
function
(){
return
this
.
$arrow
=
this
.
$arrow
||
this
.
tip
().
find
(
"
.tooltip-arrow
"
);
}
,
validate
:
function
()
{
if
(
!
this
.
$element
[
0
].
parentNode
)
{
this
.
hide
()
less/tooltip.less
+
4
-
5
Options
View file @ db6f777e
Show full file
@@ -9,14 +9,13 @@
z-index: @zindexTooltip;
display: block;
visibility: visible;
padding: 5px;
font-size: 11px;
.opacity(0);
&.in { .opacity(80); }
&.top { margin-top: -3px; }
&.right { margin-left: 3px; }
&.bottom { margin-top: 3px; }
&.left { margin-left: -3px; }
&.top { margin-top: -3px;
padding: 5px 0;
}
&.right { margin-left: 3px;
padding: 0 5px;
}
&.bottom { margin-top: 3px;
padding: 5px 0;
}
&.left { margin-left: -3px;
padding: 0 5px;
}
}
// Wrapper for the tooltip content
Menu
Explore
Projects
Groups
Snippets