Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
6fe5bb40
Commit
6fe5bb40
authored
Dec 09, 2016
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `isInViewport`
parent
719e59c7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
app/assets/javascripts/lib/utils/common_utils.js
app/assets/javascripts/lib/utils/common_utils.js
+13
-0
No files found.
app/assets/javascripts/lib/utils/common_utils.js
View file @
6fe5bb40
...
@@ -93,6 +93,19 @@
...
@@ -93,6 +93,19 @@
}
}
};
};
// Check if element scrolled into viewport from above or below
// Courtesy http://stackoverflow.com/a/7557433/414749
w
.
gl
.
utils
.
isInViewport
=
function
(
el
)
{
var
rect
=
el
.
getBoundingClientRect
();
return
(
rect
.
top
>=
0
&&
rect
.
left
>=
0
&&
rect
.
bottom
<=
window
.
innerHeight
&&
rect
.
right
<=
window
.
innerWidth
);
};
gl
.
utils
.
getPagePath
=
function
()
{
gl
.
utils
.
getPagePath
=
function
()
{
return
$
(
'
body
'
).
data
(
'
page
'
).
split
(
'
:
'
)[
0
];
return
$
(
'
body
'
).
data
(
'
page
'
).
split
(
'
:
'
)[
0
];
};
};
...
...
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