Skip to content

Instantly share code, notes, and snippets.

@imarkdesigns
Created August 25, 2013 09:00
Show Gist options
  • Save imarkdesigns/6332820 to your computer and use it in GitHub Desktop.
Save imarkdesigns/6332820 to your computer and use it in GitHub Desktop.
Customize cursor resize for textarea
.resize { cursor: row-resize; }
$("textarea").mousemove(function(e) {
var myPos = $(this).offset();
myPos.bottom = $(this).offset().top + $(this).outerHeight();
myPos.right = $(this).offset().left + $(this).outerWidth();
if (myPos.bottom > e.pageY && e.pageY > myPos.bottom - 16 && myPos.right > e.pageX && e.pageX > myPos.right - 16) {
$(this).addClass('resize');
}
else {
$(this).removeClass('resize');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment