This commit is contained in:
albert
2013-03-03 16:01:05 -05:00
parent 7c4e933bea
commit f11069a34a
2 changed files with 10 additions and 6 deletions

View File

@@ -50,7 +50,9 @@
Danbooru.Comment.initialize_response_link = function() {
$("a.expand-comment-response").click(function(e) {
$(e.target).hide();
$(e.target).closest("div.new-comment").find("form").slideDown("fast");
var $form = $(e.target).closest("div.new-comment").find("form");
$form.slideDown("fast");
Danbooru.scroll_to($form);
e.preventDefault();
});

View File

@@ -2,18 +2,20 @@
Danbooru.meta = function(key) {
return $("meta[name=" + key + "]").attr("content");
}
Danbooru.scroll_to = function(element) {
$('html, body').animate({
scrollTop: element.offset().top - 10
}, 250);
}
Danbooru.notice = function(msg) {
$('#notice').html(msg).addClass("ui-state-highlight").removeClass("ui-state-error").fadeIn("fast");
var scroll_top = $("#notice");
}
Danbooru.error = function(msg) {
$('#notice').html(msg).removeClass("ui-state-highlight").addClass("ui-state-error").fadeIn("fast");
var scroll_top = $("#notice");
$('html, body').animate({
scrollTop: scroll_top
}, 250);
Danbooru.scroll_to($("#notice"));
}
Danbooru.is_subset = function(array, subarray) {