resizeTextarea makes page blinking and scroll position reset when input
app.resizeTextarea = function (textarea) { textarea = $(textarea); if (!textarea.hasClass('resizable')) { return; } textarea.css({'height': ''}); var height = textarea[0].offsetHeight; var diff = height - textarea[0].clientHeight; var scrollHeight = textarea[0].scrollHeight;
if (scrollHeight + diff > height) { var newAreaHeight = scrollHeight + diff; textarea.css('height', newAreaHeight + 'px'); }};
I just remove above bold line "textarea.css({'height': ''});", everything works fine though textarea size can not be decreased.
Where do you see such issue and on which device? I can't replicate it
http://codepen.io/Poordeveloper/pen/RrVOjq
Exactly the same issue with my app with Cordova on iOS. But I don't understand why it's working in kitchen sink...
this code
textarea.css({'height': ''});
required to reduce textarea's size with edit or clear it.
I fixed a blinking effect by adding delay (100ms) to textarea size updating function
app.resizableTextarea = function (textarea) {
textarea = $(textarea);
if (textarea.length === 0) return;
var textareaTimeout;
function handleTextarea() {
clearTimeout(textareaTimeout);
textareaTimeout = setTimeout(function () {
app.resizeTextarea(textarea);
}, 100); //niko
}
textarea[0].f7DestroyResizableTextarea = function () {
textarea.off('change keydown keypress keyup paste cut', handleTextarea);
};
return textarea.on('change keydown keypress keyup paste cut', handleTextarea);
};
Could you please expand you point? Consider pointing code snippets here, on Codepen or on JSFiddle. Make sure you have read the documentation correctly and followed any instructions it may give.
There hasn't been a response by the issues owner in 20 days. This issue will be closed in 7 days if no further response is submitted
it was in device's webview only, not in desktop browsers...
I have this blinking on iOS device (both iPhone 7 device and emulator) when resizeTextarea on bottom of the page and keyboad are open. Commenting textarea.css({'height': ''}) on app.resizeTextarea function fix this issue, but textarea size doesn't decreases on text deleting. P.S. On Android device there is no such blinking on text input.
@nolimits4web any thoughts?
I had similar issues in UIWebView when using translate3D or translateZ in CSS so that hardware acceleration through GPU was triggered.
Try to use WKWebView in Cordova.
It was fixed in v2