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
40379902
Commit
40379902
authored
Nov 17, 2014
by
Chris Rebert
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15154 from nickyod/affix-top-bug
parents
423825f5
36b4f90f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
js/affix.js
js/affix.js
+1
-1
js/tests/unit/affix.js
js/tests/unit/affix.js
+29
-0
No files found.
js/affix.js
View file @
40379902
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
var
colliderTop
=
initializing
?
scrollTop
:
position
.
top
var
colliderTop
=
initializing
?
scrollTop
:
position
.
top
var
colliderHeight
=
initializing
?
targetHeight
:
height
var
colliderHeight
=
initializing
?
targetHeight
:
height
if
(
offsetTop
!=
null
&&
collider
Top
<=
offsetTop
)
return
'
top
'
if
(
offsetTop
!=
null
&&
scroll
Top
<=
offsetTop
)
return
'
top
'
if
(
offsetBottom
!=
null
&&
(
colliderTop
+
colliderHeight
>=
scrollHeight
-
offsetBottom
))
return
'
bottom
'
if
(
offsetBottom
!=
null
&&
(
colliderTop
+
colliderHeight
>=
scrollHeight
-
offsetBottom
))
return
'
bottom
'
return
false
return
false
...
...
js/tests/unit/affix.js
View file @
40379902
...
@@ -68,4 +68,33 @@ $(function () {
...
@@ -68,4 +68,33 @@ $(function () {
},
16
)
// for testing in a browser
},
16
)
// for testing in a browser
},
0
)
},
0
)
})
})
test
(
'
should affix-top when scrolling up to offset when parent has padding
'
,
function
()
{
stop
()
var
templateHTML
=
'
<div id="padding-offset" style="padding-top: 20px;">
'
+
'
<div id="affixTopTarget">
'
+
'
<p>Testing affix-top class is added</p>
'
+
'
</div>
'
+
'
<div style="height: 1000px; display: block;"/>
'
+
'
</div>
'
$
(
templateHTML
).
appendTo
(
document
.
body
)
$
(
'
#affixTopTarget
'
)
.
bootstrapAffix
({
offset
:
{
top
:
120
,
bottom
:
0
}
})
.
on
(
'
affixed-top.bs.affix
'
,
function
()
{
ok
(
$
(
'
#affixTopTarget
'
).
hasClass
(
'
affix-top
'
),
'
affix-top class applied
'
)
start
()
})
setTimeout
(
function
()
{
window
.
scrollTo
(
0
,
document
.
body
.
scrollHeight
)
setTimeout
(
function
()
{
window
.
scroll
(
0
,
119
)
},
250
)
},
250
)
})
})
})
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