Phonegap/Cordova Neat way to reference UI changes when Orientation changes? -


i wondering if there neat ways reference ui changes when orientation changes in phonegap app.

or have below every single element??

if ((window.orientation == 90)||(window.orientation == -90)) {                       var active_page3 = $( ":mobile-pagecontainer" ).pagecontainer( "getactivepage" );     var id3 =active_page3.page().attr('id');     if (id3==='page') {            document.getelementbyid("headerimage").style.width = "30%";                } 

media queries made problem. there developing responsive webdesigns , developing hybrid applications ;-).

@media screen , (max-width: 300px) {     body {         background-color: lightblue;     } } 

so, media query means, background-color blue, if screen max-width 300px.

before i'm going dive deep topic, recommend you, read detailed , informative information media queries on here: w3schools - media queries.

more information can found everywhere in www - google media queries, such big thing of course find relevant information.

belonging comment john, additional information

i tested jquery in application build before. used command:

console.log($(window).height(), $(document).height(), $(window).width(), $(document).width()); 

in portrait mode result is:

  • $(window).height(): 568
  • $(document).height(): 568
  • $(window).width(): 320
  • $(document).width(): 320

in landscape mode result is:

  • $(window).height(): 320
  • $(document).height(): 320
  • $(window).width(): 568
  • $(document).width(): 568

i hope, clear enough?! =)


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -