Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bootstrap
Commits
615dcb5c
Commit
615dcb5c
authored
Mar 16, 2014
by
fat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes #9855
parent
bdb70fa4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
6 deletions
+38
-6
js/modal.js
js/modal.js
+29
-6
less/modals.less
less/modals.less
+9
-0
No files found.
js/modal.js
View file @
615dcb5c
...
...
@@ -15,6 +15,7 @@
var
Modal
=
function
(
element
,
options
)
{
this
.
options
=
options
this
.
$body
=
$
(
document
.
body
)
this
.
$element
=
$
(
element
)
this
.
$backdrop
=
this
.
isShown
=
null
...
...
@@ -48,6 +49,9 @@
this
.
isShown
=
true
this
.
$body
.
addClass
(
'
modal-open
'
)
this
.
setScrollbar
()
this
.
escape
()
this
.
$element
.
on
(
'
click.dismiss.bs.modal
'
,
'
[data-dismiss="modal"]
'
,
$
.
proxy
(
this
.
hide
,
this
))
...
...
@@ -56,7 +60,7 @@
var
transition
=
$
.
support
.
transition
&&
that
.
$element
.
hasClass
(
'
fade
'
)
if
(
!
that
.
$element
.
parent
().
length
)
{
that
.
$element
.
appendTo
(
document
.
body
)
// don't move modals dom position
that
.
$element
.
appendTo
(
that
.
$
body
)
// don't move modals dom position
}
that
.
$element
...
...
@@ -96,6 +100,9 @@
this
.
isShown
=
false
this
.
$body
.
removeClass
(
'
modal-open
'
)
this
.
resetScrollbar
()
this
.
escape
()
$
(
document
).
off
(
'
focusin.bs.modal
'
)
...
...
@@ -153,7 +160,7 @@
var
doAnimate
=
$
.
support
.
transition
&&
animate
this
.
$backdrop
=
$
(
'
<div class="modal-backdrop
'
+
animate
+
'
" />
'
)
.
appendTo
(
document
.
body
)
.
appendTo
(
this
.
$
body
)
this
.
$element
.
on
(
'
click.dismiss.bs.modal
'
,
$
.
proxy
(
function
(
e
)
{
if
(
e
.
target
!==
e
.
currentTarget
)
return
...
...
@@ -188,6 +195,26 @@
}
}
Modal
.
prototype
.
setScrollbar
=
function
()
{
if
(
document
.
body
.
clientHeight
<=
window
.
innerHeight
)
return
var
scrollbarWidth
=
this
.
measureScrollbar
()
var
bodyPad
=
parseInt
(
this
.
$body
.
css
(
'
padding-right
'
)
||
0
)
if
(
scrollbarWidth
)
this
.
$body
.
css
(
'
padding-right
'
,
bodyPad
+
scrollbarWidth
)
}
Modal
.
prototype
.
resetScrollbar
=
function
()
{
this
.
$body
.
css
(
'
padding-right
'
,
''
)
}
Modal
.
prototype
.
measureScrollbar
=
function
()
{
// thx walsh
var
scrollDiv
=
document
.
createElement
(
'
div
'
)
scrollDiv
.
className
=
'
modal-scrollbar-measure
'
this
.
$body
.
append
(
scrollDiv
)
var
scrollbarWidth
=
scrollDiv
.
offsetWidth
-
scrollDiv
.
clientWidth
this
.
$body
[
0
].
removeChild
(
scrollDiv
)
return
scrollbarWidth
}
// MODAL PLUGIN DEFINITION
// =======================
...
...
@@ -236,8 +263,4 @@
})
})
$
(
document
)
.
on
(
'
show.bs.modal
'
,
'
.modal
'
,
function
()
{
$
(
document
.
body
).
addClass
(
'
modal-open
'
)
})
.
on
(
'
hidden.bs.modal
'
,
'
.modal
'
,
function
()
{
$
(
document
.
body
).
removeClass
(
'
modal-open
'
)
})
}(
jQuery
);
less/modals.less
View file @
615dcb5c
...
...
@@ -118,6 +118,15 @@
}
}
// Measure scrollbar width for padding body during modal show/hide
.modal-scrollbar-measure {
position: absolute;
top: -9999px;
width: 50px;
height: 50px;
overflow: scroll;
}
// Scale up the modal
@media (min-width: @screen-sm-min) {
// Automatically set modal's width for larger viewports
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment