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
b0d14233
Commit
b0d14233
authored
May 13, 2015
by
fat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #15301
parent
7ef0e52f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
93 additions
and
12 deletions
+93
-12
js/dist/modal.js
js/dist/modal.js
+3
-2
js/dist/modal.js.map
js/dist/modal.js.map
+0
-0
js/dist/scrollspy.js
js/dist/scrollspy.js
+23
-5
js/dist/scrollspy.js.map
js/dist/scrollspy.js.map
+0
-0
js/src/modal.js
js/src/modal.js
+1
-1
js/src/scrollspy.js
js/src/scrollspy.js
+21
-4
js/tests/unit/scrollspy.js
js/tests/unit/scrollspy.js
+45
-0
No files found.
js/dist/modal.js
View file @
b0d14233
...
...
@@ -31,6 +31,7 @@ var Modal = (function ($) {
var
Default
=
{
backdrop
:
true
,
keyboard
:
true
,
focus
:
true
,
show
:
true
};
...
...
@@ -206,14 +207,14 @@ var Modal = (function ($) {
$
(
this
.
_element
).
addClass
(
ClassName
.
IN
);
this
.
_enforceFocus
();
if
(
this
.
_config
.
focus
)
this
.
_enforceFocus
();
var
shownEvent
=
$
.
Event
(
Event
.
SHOWN
,
{
relatedTarget
:
relatedTarget
});
var
transitionComplete
=
function
transitionComplete
()
{
_this2
.
_element
.
focus
();
if
(
_this2
.
_config
.
focus
)
_this2
.
_element
.
focus
();
$
(
_this2
.
_element
).
trigger
(
shownEvent
);
};
...
...
js/dist/modal.js.map
View file @
b0d14233
This diff was suppressed by a .gitattributes entry.
js/dist/scrollspy.js
View file @
b0d14233
...
...
@@ -28,7 +28,8 @@ var ScrollSpy = (function ($) {
var
Default
=
{
offset
:
10
,
method
:
'
auto
'
method
:
'
auto
'
,
target
:
''
};
var
Event
=
{
...
...
@@ -45,8 +46,9 @@ var ScrollSpy = (function ($) {
var
Selector
=
{
DATA_SPY
:
'
[data-spy="scroll"]
'
,
ACTIVE
:
'
.active
'
,
LI
:
'
li
'
,
LI_DROPDOWN
:
'
li.dropdown
'
,
LI
:
'
li
'
NAV_ANCHORS
:
'
.nav li > a
'
};
var
OffsetMethod
=
{
...
...
@@ -66,8 +68,8 @@ var ScrollSpy = (function ($) {
this
.
_element
=
element
;
this
.
_scrollElement
=
element
.
tagName
===
'
BODY
'
?
window
:
element
;
this
.
_config
=
$
.
extend
({},
Default
,
config
);
this
.
_selector
=
''
+
(
this
.
_config
.
target
||
''
)
+
'
.nav li > a
'
;
this
.
_config
=
this
.
_getConfig
(
config
);
this
.
_selector
=
''
+
this
.
_config
.
target
+
'
'
+
Selector
.
NAV_ANCHORS
;
this
.
_offsets
=
[];
this
.
_targets
=
[];
this
.
_activeTarget
=
null
;
...
...
@@ -137,10 +139,26 @@ var ScrollSpy = (function ($) {
this
.
_scrollHeight
=
null
;
}
},
{
key
:
'
_get
ScrollTop
'
,
key
:
'
_get
Config
'
,
// private
value
:
function
_getConfig
(
config
)
{
config
=
$
.
extend
({},
Default
,
config
);
if
(
typeof
config
.
target
!==
'
string
'
)
{
var
id
=
$
(
config
.
target
).
attr
(
'
id
'
);
if
(
!
id
)
{
id
=
Util
.
getUID
(
NAME
);
$
(
config
.
target
).
attr
(
'
id
'
,
id
);
}
config
.
target
=
'
#
'
+
id
;
}
return
config
;
}
},
{
key
:
'
_getScrollTop
'
,
value
:
function
_getScrollTop
()
{
return
this
.
_scrollElement
===
window
?
this
.
_scrollElement
.
scrollY
:
this
.
_scrollElement
.
scrollTop
;
}
...
...
js/dist/scrollspy.js.map
View file @
b0d14233
This diff was suppressed by a .gitattributes entry.
js/src/modal.js
View file @
b0d14233
...
...
@@ -217,7 +217,7 @@ const Modal = (($) => {
$
(
this
.
_element
).
addClass
(
ClassName
.
IN
)
this
.
_enforceFocus
()
if
(
this
.
_config
.
focus
)
this
.
_enforceFocus
()
let
shownEvent
=
$
.
Event
(
Event
.
SHOWN
,
{
relatedTarget
:
relatedTarget
...
...
js/src/scrollspy.js
View file @
b0d14233
...
...
@@ -26,7 +26,8 @@ const ScrollSpy = (($) => {
const
Default
=
{
offset
:
10
,
method
:
'
auto
'
method
:
'
auto
'
,
target
:
''
}
const
Event
=
{
...
...
@@ -43,8 +44,9 @@ const ScrollSpy = (($) => {
const
Selector
=
{
DATA_SPY
:
'
[data-spy="scroll"]
'
,
ACTIVE
:
'
.active
'
,
LI
:
'
li
'
,
LI_DROPDOWN
:
'
li.dropdown
'
,
LI
:
'
li
'
NAV_ANCHORS
:
'
.nav li > a
'
}
const
OffsetMethod
=
{
...
...
@@ -64,8 +66,8 @@ const ScrollSpy = (($) => {
constructor
(
element
,
config
)
{
this
.
_element
=
element
this
.
_scrollElement
=
element
.
tagName
===
'
BODY
'
?
window
:
element
this
.
_config
=
$
.
extend
({},
Default
,
config
)
this
.
_selector
=
`
${
this
.
_config
.
target
||
''
}
.nav li > a
`
this
.
_config
=
this
.
_getConfig
(
config
)
this
.
_selector
=
`
${
this
.
_config
.
target
}
${
Selector
.
NAV_ANCHORS
}
`
this
.
_offsets
=
[]
this
.
_targets
=
[]
this
.
_activeTarget
=
null
...
...
@@ -150,6 +152,21 @@ const ScrollSpy = (($) => {
// private
_getConfig
(
config
)
{
config
=
$
.
extend
({},
Default
,
config
)
if
(
typeof
config
.
target
!==
'
string
'
)
{
let
id
=
$
(
config
.
target
).
attr
(
'
id
'
)
if
(
!
id
)
{
id
=
Util
.
getUID
(
NAME
)
$
(
config
.
target
).
attr
(
'
id
'
,
id
)
}
config
.
target
=
`#
${
id
}
`
}
return
config
}
_getScrollTop
()
{
return
this
.
_scrollElement
===
window
?
this
.
_scrollElement
.
scrollY
:
this
.
_scrollElement
.
scrollTop
...
...
js/tests/unit/scrollspy.js
View file @
b0d14233
...
...
@@ -77,6 +77,51 @@ $(function () {
$scrollspy
.
scrollTop
(
350
)
})
QUnit
.
test
(
'
should only switch "active" class on current target specified w element
'
,
function
(
assert
)
{
assert
.
expect
(
1
)
var
done
=
assert
.
async
()
var
sectionHTML
=
'
<div id="root" class="active">
'
+
'
<div class="topbar">
'
+
'
<div class="topbar-inner">
'
+
'
<div class="container" id="ss-target">
'
+
'
<ul class="nav">
'
+
'
<li><a href="#masthead">Overview</a></li>
'
+
'
<li><a href="#detail">Detail</a></li>
'
+
'
</ul>
'
+
'
</div>
'
+
'
</div>
'
+
'
</div>
'
+
'
<div id="scrollspy-example" style="height: 100px; overflow: auto;">
'
+
'
<div style="height: 200px;">
'
+
'
<h4 id="masthead">Overview</h4>
'
+
'
<p style="height: 200px">
'
+
'
Ad leggings keytar, brunch id art party dolor labore.
'
+
'
</p>
'
+
'
</div>
'
+
'
<div style="height: 200px;">
'
+
'
<h4 id="detail">Detail</h4>
'
+
'
<p style="height: 200px">
'
+
'
Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard.
'
+
'
</p>
'
+
'
</div>
'
+
'
</div>
'
+
'
</div>
'
var
$section
=
$
(
sectionHTML
).
appendTo
(
'
#qunit-fixture
'
)
var
$scrollspy
=
$section
.
show
()
.
find
(
'
#scrollspy-example
'
)
.
bootstrapScrollspy
({
target
:
$
(
'
#ss-target
'
)
})
$scrollspy
.
on
(
'
scroll.bs.scrollspy
'
,
function
()
{
assert
.
ok
(
$section
.
hasClass
(
'
active
'
),
'
"active" class still on root node
'
)
done
()
})
$scrollspy
.
scrollTop
(
350
)
})
QUnit
.
test
(
'
should correctly select middle navigation option when large offset is used
'
,
function
(
assert
)
{
assert
.
expect
(
3
)
var
done
=
assert
.
async
()
...
...
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