javascript - Website turns to landscape with keyboard -



i've ran interesting problem. on website have 2 versions of navigation bar mobiles - landscape , portrait. detect these 2 use css media orientation.

@media (orientation: landscape)  {   /* inline menu */   }  @media (orientation: portrait)  {   /* multiple rows menu */  } 

however, when open keyboard page turns landscape, because actual page size becomes smaller.
can me how fix this? can think focus event on inputs, whenever they're focused portrait manu turned on, change menu on landscape. here's illustrative image portrait/landscape/portrait keyboard

thanks!

if check media queries w3c recommendation

you find interesting sentence:

the ‘orientation’ media feature ‘portrait’ when value of ‘height’ media feature greater or equal value of ‘width’ media feature. otherwise ‘orientation’ ‘landscape’.

so, when keyboard opened, page turn landscape mode.

there multiple ways overcome problem, can check this answer.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -