Fixed notes disappearing off the screen
This commit is contained in:
parent
e623513e3d
commit
92631df9a4
2 changed files with 15 additions and 4 deletions
|
@ -269,9 +269,6 @@
|
|||
background: lemonchiffon;
|
||||
border: 1px solid black;
|
||||
}
|
||||
.post-note:hover .text-wrapper {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.post-note .text p:first-of-type {
|
||||
margin-top: 0;
|
||||
|
|
|
@ -63,6 +63,8 @@ App.Presenters.PostNotesPresenter = function(
|
|||
postNote.$element = $postNote;
|
||||
draggable.makeDraggable($postNote, draggable.relativeDragStrategy, true);
|
||||
resizable.makeResizable($postNote, true);
|
||||
$postNote.mouseenter(function() { postNoteMouseEnter(postNote); });
|
||||
$postNote.mouseleave(function() { postNoteMouseLeave(postNote); });
|
||||
});
|
||||
|
||||
$form.find('button').click(formSubmitted);
|
||||
|
@ -144,13 +146,25 @@ App.Presenters.PostNotesPresenter = function(
|
|||
}
|
||||
|
||||
function showPostNoteText(postNote) {
|
||||
postNote.$element.find('.text-wrapper').show();
|
||||
var $textWrapper = postNote.$element.find('.text-wrapper');
|
||||
$textWrapper.show();
|
||||
if ($textWrapper.offset().left + $textWrapper.width() > jQuery(window).outerWidth()) {
|
||||
$textWrapper.offset({left: jQuery(window).outerWidth() - $textWrapper.width()});
|
||||
}
|
||||
}
|
||||
|
||||
function hidePostNoteText(postNote) {
|
||||
postNote.$element.find('.text-wrapper').css('display', '');
|
||||
}
|
||||
|
||||
function postNoteMouseEnter(postNote) {
|
||||
showPostNoteText(postNote);
|
||||
}
|
||||
|
||||
function postNoteMouseLeave(postNote) {
|
||||
hidePostNoteText(postNote);
|
||||
}
|
||||
|
||||
function postNoteClicked(e) {
|
||||
e.preventDefault();
|
||||
var $postNote = jQuery(e.currentTarget).parents('.post-note');
|
||||
|
|
Loading…
Reference in a new issue