Closed jcppkkk closed 9 years ago
Hi @jcppkkk Without this adjustment the height of description textarea in simple mode can be too big or too small. http://goo.gl/lHGl1L
However it resizes my description's height to one line height: I think the flow in original code will
So i decide to modify code. The result is following image
diff --git a/assets/javascripts/simplify_description.js b/assets/javascripts/simplify_description.js
index d4e15c2..a6e416e 100644
--- a/assets/javascripts/simplify_description.js
+++ b/assets/javascripts/simplify_description.js
@@ -1,11 +1,11 @@
function adaptiveHeight(a, min, max) {
- if ($(a).height() > min) {
- $(a).height(0);
- var newHeight = Math.min($(a)[0].scrollHeight, max);
- $(a).height(newHeight);
- if (parseInt(a.style.height) > $(window).height() - 30) {
- $(document).scrollTop(parseInt(a.style.height));
- }
+ scrollHeight = $(a)[0].scrollHeight
+ if (scrollHeight < min) {
+ $(a).height(min);
+ } else if(scrollHeight > max) {
+ $(a).height(max);
+ } else {
+ $(a).height(scrollHeight);
}
}
Thanks @jcppkkk. I have fixed too small height bug.
hi @nodecarter https://github.com/Undev/redmine_simple/blob/master/assets/javascripts/simplify_description.js#L1 When adjusting description text area, the min parameter in adaptiveHeight seems not actually setting minimal height. What's the intention of function adaptiveHeight ?