1
I’m needing to know the px size of the input field with a focus on the top of the screen. To give a scrollTOP and the focus field stay at the top of the screen.
The idea of the problem is as follows:
I am working mobile, and I am using hybrid methods to develop, for this reason I have HTML5
, CSS3
,JQUERY
among other web media to develop. I need a Generic solution so that whatever page the person is browsing, they take the field that is being typed and put it at the top of the page. The page in the sense of div
, for every div
is a view
, to div
that is being visualized has the display: block
but the rest are left with display: none
.
Through the specifications how to develop ?
I started doing some things but I don’t know how to continue, follow the code:
window.addEventListener("resize", function() {
is_keyboard = (window.innerHeight < initial_screen_size);
is_landscape = (screen.height < screen.width);
updateViews();
}, false);
function updateViews() {
// $("#ajusteTeclado").show();
console.log("Entro aqui.");
var elmnt = document.getElementById("login");
elmnt.scrollTop = 500;
$('#login').css('top','100px');
}
However as I used it is all manual I need to take the field in focus.
The field that receives a
focus
is centered/visible in the right browser? I don’t quite understand what you’re not able to do...– Sergio
@Sergio I’m actually working with mobile, and I have several fields on the screen, my idea is when you click some input whatever it is, climb to the top of the page. The reason is to give better visibility to what the guy is typing.
– Renan Rodrigues
So you want to scroll to get the input to the top of the page that’s it?
– Sergio
Just what I need.
– Renan Rodrigues