mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-12-01 07:37:18 +01:00
Fix animation when append or remove notes
This commit is contained in:
11
js/script.js
11
js/script.js
@@ -76,6 +76,9 @@ Notes.prototype = {
|
|||||||
}
|
}
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
},
|
},
|
||||||
|
length: function () {
|
||||||
|
return this._notes.length;
|
||||||
|
},
|
||||||
create: function (note) {
|
create: function (note) {
|
||||||
var deferred = $.Deferred();
|
var deferred = $.Deferred();
|
||||||
var self = this;
|
var self = this;
|
||||||
@@ -189,6 +192,9 @@ View.prototype = {
|
|||||||
"min-height": note.height(),
|
"min-height": note.height(),
|
||||||
"height:" : "auto"
|
"height:" : "auto"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: Animate to center.
|
||||||
|
|
||||||
modal.removeClass("hide-modal-note");
|
modal.removeClass("hide-modal-note");
|
||||||
modal.addClass("show-modal-note");
|
modal.addClass("show-modal-note");
|
||||||
modalcontent.focus();
|
modalcontent.focus();
|
||||||
@@ -299,10 +305,9 @@ View.prototype = {
|
|||||||
|
|
||||||
self._notes.load(id);
|
self._notes.load(id);
|
||||||
self._notes.removeActive().done(function () {
|
self._notes.removeActive().done(function () {
|
||||||
if (self._notes.length == 0) {
|
if (self._notes.length() > 1) {
|
||||||
$(".notes-grid").isotope('remove', note.parent())
|
$(".notes-grid").isotope('remove', note.parent())
|
||||||
.isotope('layout');
|
.isotope('layout');
|
||||||
self.showAll();
|
|
||||||
self.renderNavigation();
|
self.renderNavigation();
|
||||||
} else {
|
} else {
|
||||||
self.render();
|
self.render();
|
||||||
@@ -388,7 +393,7 @@ View.prototype = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
self._notes.create(note).done(function() {
|
self._notes.create(note).done(function() {
|
||||||
if (self._notes.length > 1) {
|
if (self._notes.length() > 1) {
|
||||||
note = self._notes.getActive();
|
note = self._notes.getActive();
|
||||||
var $notehtml = $("<div class=\"note-grid-item\">" +
|
var $notehtml = $("<div class=\"note-grid-item\">" +
|
||||||
"<div class=\"quicknote noselect\" style=\"background-color:" + note.color + "\" data-id=\"" + note.id + "\">" +
|
"<div class=\"quicknote noselect\" style=\"background-color:" + note.color + "\" data-id=\"" + note.id + "\">" +
|
||||||
|
|||||||
Reference in New Issue
Block a user