书签详情定位

This commit is contained in:
luchenqun 2018-04-15 23:10:45 +08:00
parent 52b870ac52
commit 3cb2187254
1 changed files with 9 additions and 2 deletions

View File

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