mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-02 21:51:51 +08:00
fixed comment options dropdown position
This commit is contained in:
parent
d90f17d1eb
commit
bca3d19562
1 changed files with 5 additions and 11 deletions
|
@ -170,7 +170,7 @@ var Comments = (function() {
|
|||
} else {
|
||||
useParentOffset = true;
|
||||
}
|
||||
scrollCommentOptions($('.dropdown-comment'), useParentOffset);
|
||||
scrollCommentOptions($('.dropdown-comment'));
|
||||
|
||||
// Reposition dropdown to the left
|
||||
// (only do this when using parent offset)
|
||||
|
@ -191,22 +191,17 @@ var Comments = (function() {
|
|||
var parent = $(scrollableContainer);
|
||||
|
||||
if ($target.length) {
|
||||
scrollCommentOptions(parent.find('.dropdown-comment'), useParentOffset);
|
||||
scrollCommentOptions(parent.find('.dropdown-comment'));
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
function scrollCommentOptions(selector, useParentOffset) {
|
||||
if ( ! _.isUndefined(typeof useParentOffset) ) {
|
||||
useParentOffset = useParentOffset;
|
||||
} else {
|
||||
useParentOffset = true;
|
||||
}
|
||||
function scrollCommentOptions(selector) {
|
||||
_.each(selector, function(el) {
|
||||
var $el = $(el);
|
||||
var offset = useParentOffset ? $el.offset().top : $el.position().top;
|
||||
var offset = $el.offset().top;
|
||||
$el.find('.dropdown-menu-fixed')
|
||||
.offset({ top: (offset + 20) });
|
||||
.offset({ top: (offset + 20) });
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -337,7 +332,6 @@ var Comments = (function() {
|
|||
form: initCommentForm,
|
||||
bindNewElement: bindCommentInitializerToNewElement,
|
||||
initCommentOptions: initCommentOptions,
|
||||
scrollCommentOptions: scrollCommentOptions,
|
||||
initDeleteComments: initDeleteComments,
|
||||
initEditComments: initEditComments
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue