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
eff9b063
Commit
eff9b063
authored
Jul 21, 2014
by
fat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup style
parent
724c4f52
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
24 deletions
+17
-24
js/affix.js
js/affix.js
+17
-24
No files found.
js/affix.js
View file @
eff9b063
...
...
@@ -38,32 +38,25 @@
}
Affix
.
prototype
.
getState
=
function
(
scrollHeight
,
height
,
offsetTop
,
offsetBottom
)
{
var
scrollTop
=
this
.
$target
.
scrollTop
()
var
position
=
this
.
$element
.
offset
()
var
targetHeight
=
this
.
$target
.
height
()
var
scrollTop
=
this
.
$target
.
scrollTop
()
var
position
=
this
.
$element
.
offset
()
var
targetHeight
=
this
.
$target
.
height
()
if
(
offsetTop
!=
null
&&
this
.
affixed
==
'
top
'
)
return
scrollTop
<
offsetTop
?
'
top
'
:
false
if
(
offsetTop
!=
null
&&
this
.
affixed
==
'
top
'
)
return
scrollTop
>=
offsetTop
?
false
:
'
top
'
if
(
this
.
affixed
==
'
bottom
'
)
{
// Can be affixed to the top, use the unpin value
if
(
offsetTop
!=
null
)
{
return
(
scrollTop
+
this
.
unpin
<=
position
.
top
)
?
false
:
'
bottom
'
// Can only ever be pinned or affixed to the bottom, ignore unpin value
}
else
{
return
(
scrollTop
+
targetHeight
<=
scrollHeight
-
offsetBottom
)
?
false
:
'
bottom
'
}
}
else
{
var
initializing
=
this
.
affixed
==
null
var
colliderTop
=
initializing
?
scrollTop
:
position
.
top
var
colliderHeight
=
initializing
?
targetHeight
:
height
if
(
offsetTop
!=
null
&&
colliderTop
<=
offsetTop
)
{
return
'
top
'
}
else
if
(
offsetBottom
!=
null
&&
(
colliderTop
+
colliderHeight
>=
scrollHeight
-
offsetBottom
))
{
return
'
bottom
'
}
else
{
return
false
}
if
(
offsetTop
!=
null
)
return
(
scrollTop
+
this
.
unpin
<=
position
.
top
)
?
false
:
'
bottom
'
return
(
scrollTop
+
targetHeight
<=
scrollHeight
-
offsetBottom
)
?
false
:
'
bottom
'
}
var
initializing
=
this
.
affixed
==
null
var
colliderTop
=
initializing
?
scrollTop
:
position
.
top
var
colliderHeight
=
initializing
?
targetHeight
:
height
if
(
offsetTop
!=
null
&&
colliderTop
<=
offsetTop
)
return
'
top
'
if
(
offsetBottom
!=
null
&&
(
colliderTop
+
colliderHeight
>=
scrollHeight
-
offsetBottom
))
return
'
bottom
'
return
false
}
Affix
.
prototype
.
getPinnedOffset
=
function
()
{
...
...
@@ -81,11 +74,11 @@
Affix
.
prototype
.
checkPosition
=
function
()
{
if
(
!
this
.
$element
.
is
(
'
:visible
'
))
return
var
scrollHeight
=
$
(
'
body
'
).
height
()
var
height
=
this
.
$element
.
height
()
var
offset
=
this
.
options
.
offset
var
offsetTop
=
offset
.
top
var
offsetBottom
=
offset
.
bottom
var
scrollHeight
=
$
(
'
body
'
).
height
()
if
(
typeof
offset
!=
'
object
'
)
offsetBottom
=
offsetTop
=
offset
if
(
typeof
offsetTop
==
'
function
'
)
offsetTop
=
offset
.
top
(
this
.
$element
)
...
...
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