Web applications: responsive to iphone tilts
Many are afraid to write applications for iphone, fearing complexity. In fact, there is nothing complicated.
Today I will touch on the topic of how your website responds to device tilts.
Let's look at the code, which is just plain javascript: Do you really think that this is anything complicated? Welcome to Apple Developer Center UPDATE: if anyone is interested, I’ll tell you a little more about interesting, but slightly more boring things. About screen resolution, how to make your application be of a normal size and not have to zoom in, principles of interface construction, etc.
Today I will touch on the topic of how your website responds to device tilts.
Let's look at the code, which is just plain javascript: Do you really think that this is anything complicated? Welcome to Apple Developer Center UPDATE: if anyone is interested, I’ll tell you a little more about interesting, but slightly more boring things. About screen resolution, how to make your application be of a normal size and not have to zoom in, principles of interface construction, etc.
// Создадим функцию, которая будет вызываться автоматическе при изменении положения устройства
function updateOrientation()
{
var orientation=window.orientation;
switch(orientation)
{
case 0:
alert("Нормальное положение");
case 90:
alert("Наклонен влево");
case -90:
alert("Наклонен вправо");
}
}
window.onorientationchange=updateOrientation; // и задаем ее