diff --git a/app/assets/javascripts/comments.js b/app/assets/javascripts/comments.js index 4c74beeae..681dc0dc3 100644 --- a/app/assets/javascripts/comments.js +++ b/app/assets/javascripts/comments.js @@ -170,7 +170,7 @@ var Comments = (function() { } else { useParentOffset = true; } - scrollCommentOptions($('.dropdown-comment')); + scrollCommentOptions($('.dropdown-comment'), useParentOffset); // Reposition dropdown to the left // (only do this when using parent offset) @@ -191,15 +191,20 @@ var Comments = (function() { var parent = $(scrollableContainer); if ($target.length) { - scrollCommentOptions(parent.find('.dropdown-comment')); + scrollCommentOptions(parent.find('.dropdown-comment'), useParentOffset); } }, true); } - function scrollCommentOptions(selector) { + function scrollCommentOptions(selector, useParentOffset) { + if ( ! _.isUndefined(typeof useParentOffset) ) { + useParentOffset = useParentOffset; + } else { + useParentOffset = true; + } _.each(selector, function(el) { var $el = $(el); - var offset = $el.offset().top; + var offset = useParentOffset ? $el.offset().top : $el.position().top; $el.find('.dropdown-menu-fixed') .offset({ top: (offset + 20) }); }); diff --git a/app/assets/javascripts/projects/index.js b/app/assets/javascripts/projects/index.js index 1bc1a0048..83efb6bcd 100644 --- a/app/assets/javascripts/projects/index.js +++ b/app/assets/javascripts/projects/index.js @@ -284,7 +284,7 @@ initNewProjectModal(); initEditProjectModal(); initManageUsersModal(); - Comments.initCommentOptions("ul.content-comments"); + Comments.initCommentOptions("ul.content-comments", true); Comments.initEditComments(".panel-project .tab-content"); Comments.initDeleteComments(".panel-project .tab-content");