better fix for not scrolling textarea
This commit is contained in:
@@ -226,9 +226,7 @@
|
|||||||
Danbooru.RelatedTag.process_artist(Danbooru.RelatedTag.recent_artist);
|
Danbooru.RelatedTag.process_artist(Danbooru.RelatedTag.recent_artist);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($(window).scrollTop() <= $field.offset().top) {
|
$field.focusWithoutScroll();
|
||||||
$field.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,4 +103,11 @@
|
|||||||
this.selectRange(this.val().length, this.val().length);
|
this.selectRange(this.val().length, this.val().length);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$.fn.focusWithoutScroll = function(){
|
||||||
|
var x = window.scrollX;
|
||||||
|
var y = window.scrollY;
|
||||||
|
this.focus();
|
||||||
|
window.scrollTo(x, y);
|
||||||
|
};
|
||||||
})();
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user