bgrins / ExpandingTextareas

jQuery plugin for elegant expanding textareas
http://bgrins.github.com/ExpandingTextareas/
MIT License
261 stars 73 forks source link

onBeforeResize and onAfterResize callbacks #11

Closed joshweinstein closed 12 years ago

joshweinstein commented 12 years ago

Thanks for making this awesome plug-in! I added some callbacks to it. If you like them, pls merge into master.

Thx, Josh

bgrins commented 12 years ago

Thanks Josh!

Do you have an example of when this might be used that could be added to the docs at index.html? I would like to make sure we explain the feature well.

Also, it looks like the whitespace got mixed up somehow during the commit - maybe you have tabs turned on in your editor? This project uses spaces instead of tabs. If you add a little demo and switch over to spaces, I'll happily merge it in.

Thanks, Brian

joshweinstein commented 12 years ago

Thx Brian. Fixed whitespace and added documentation.

bgrins commented 12 years ago

In the process of merging this, I ran into this question: Do you actually use the value from onBeforeResize or only onAfterResize? What if we just exposed one method, onResize?

joshweinstein commented 12 years ago

Smart. Updated the pull commit accordingly.

joshweinstein commented 12 years ago

I ended up needing the outerHeight instead of height, so might as well just pass the jQuery-wrapped textarea and let the user decide what to do with it.

bgrins commented 12 years ago

This is fixed by commit: https://github.com/bgrins/ExpandingTextareas/commit/bc437c4ad626653e5f63f125efbfda8917581fee.

Thanks for adding this in - I basically used the resize callback along with the context of the textarea so you can do whatever you want with it.

So in your case you could say $(this).outerHeight() in the callback.