You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/12/02 17:37:33 UTC

[GitHub] turkimud edited a comment on issue #417: Keyboard Dismissal Leaves Viewport Shifted in iOS 12 / XCode 10

turkimud edited a comment on issue #417: Keyboard Dismissal Leaves Viewport Shifted in iOS 12 / XCode 10
URL: https://github.com/apache/cordova-ios/issues/417#issuecomment-443525395
 
 
   Another ugly fix:
   
   ```
   <body>	
   	<div id="Container">
   	
   	</div>	
   </body>
   ```
   div **id="Container"** wrapper for all html
   
   Then use the following code in device ready
   
   ```
   if (device.platform.toLowerCase() == "ios" && device.version.split('.')[0] >= 12) {
   	var inputYoffset = 0;
   	var oneRunTimer = false;
   	$("body").on('DOMSubtreeModified', "#Container", function() {
   		if (oneRunTimer == false) {
   			oneRunTimer = true;
   			setTimeout(function() {
   				$("input:not([type=submit]),textarea").on("focus",function (e) {
   					inputYoffset = window.pageYOffset;
   				});
   				$("input:not([type=submit]),textarea").on("blur",function (e) {
   					document.getElementsByTagName('html')[0].style.height = '101vh';
   					setTimeout(function() {
   						document.getElementsByTagName('html')[0].style.height = '100vh';
   						window.scrollTo(0, 0);
   						window.scrollTo(0, inputYoffset);
   					}, 40);	    		
   				});
   				oneRunTimer = false;
   			}, 400);
   		}
   	});
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org