diff --git a/public/scripts/controllers/note-controller.js b/public/scripts/controllers/note-controller.js index 889fdca..c812bd0 100644 --- a/public/scripts/controllers/note-controller.js +++ b/public/scripts/controllers/note-controller.js @@ -215,6 +215,7 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind note.content = $scope.content; note.tagName = tagName; note.tag_id = $scope.currentTagId; + toPos(note.id); } }) $scope.add = false; @@ -270,10 +271,10 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind var detail = note.detail; $scope.notes.forEach((note) => { note.detail = false; - $("#" + note.id).removeClass("secondary") + $("#" + note.id).removeClass("secondary"); }) note.detail = !detail; - note.detail && $("#" + note.id).addClass("secondary") + note.detail && $("#" + note.id).addClass("secondary") && toPos(note.id); } if (flag) { $event && $event.stopPropagation(); @@ -387,4 +388,10 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind duration: 500, }); } + + function toPos(id) { + setTimeout(function(){ + $('html,body').animate({ scrollTop: $('#' + id).offset().top - 20 }, 100); + }, 36); + } }]);