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
858eee9e
Commit
858eee9e
authored
Mar 24, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly scrolls the dropdown up & down with arrow keys
parent
b244317a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+11
-4
No files found.
app/assets/javascripts/gl_dropdown.js.coffee
View file @
858eee9e
...
...
@@ -436,15 +436,22 @@ class GitLabDropdown
# Dropdown content scroll area
$dropdownContent
=
$listItem
.
closest
(
'.dropdown-content'
)
dropdownContentBottom
=
$dropdownContent
.
prop
(
'offsetTop'
)
+
$dropdownContent
.
prop
(
'offsetHeight'
)
dropdownScrollTop
=
$dropdownContent
.
prop
(
'scrollTop'
)
dropdownContentHeight
=
$dropdownContent
.
prop
(
'offsetHeight'
)
dropdownContentTop
=
$dropdownContent
.
prop
(
'offsetTop'
)
dropdownContentBottom
=
dropdownContentTop
+
dropdownContentHeight
# Get the offset bottom of the list item
listItemBottom
=
$listItem
.
prop
(
'offsetTop'
)
+
$listItem
.
prop
(
'offsetHeight'
)
console
.
log
listItemBottom
,
dropdownContentBottom
listItemHeight
=
$listItem
.
prop
(
'offsetHeight'
)
listItemTop
=
$listItem
.
prop
(
'offsetTop'
)
listItemBottom
=
listItemTop
+
listItemHeight
if
listItemBottom
>
dropdownContentBottom
if
listItemBottom
>
dropdownContentBottom
+
dropdownScrollTop
# Scroll the dropdown content down
$dropdownContent
.
scrollTop
(
listItemBottom
-
dropdownContentBottom
)
else
if
listItemTop
<
dropdownContentTop
+
dropdownScrollTop
# Scroll the dropdown content up
$dropdownContent
.
scrollTop
(
listItemTop
-
dropdownContentTop
)
$
.
fn
.
glDropdown
=
(
opts
)
->
return
@
.
each
->
...
...
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