title: Getting the users viewport size in ems
body: <p><strong>EDIT</strong><br>
  The follow code gets the size of an em, but is not corresponding to my css.  </p>
  
  <pre><code>function doOnOrientationChange() {
          // Orientation of device has changed, change the size of map and move the maphelp (if required)
          var eminpx = $("#1em").width();
          var largescreeninpx = eminpx*66.236;
          switch(window.orientation) {
              case -90:
              case 90:
                  // Orientation is landscape
                  console.log('66.236ems in px: ' + largescreeninpx + '. Screen width: ' + screen.height);
                  $("#map").height(screen.width*0.7); // The screen width is the viewport height of the device because we're in landscape orientation
                  // Will only work if we can actually get the em value of the width
                  if (screen.height &lt; largescreeninpx) {
                       // Small or medium screen, show map help below map
                       console.log('small screen');
                      $("#maphelp").css('margin-top', 0);
                  } else {
                      // Larger screen, show map and map help side-by-side
                      $("#maphelp").css('margin-top', -screen.width*0.7);
                  }
                  break; 
              default:
                  // Orientation is portrait
                  alert('66.23ems in px: ' + largescreeninpx + '. Screen width: ' + screen.width);
                  $("#map").height(screen.height*0.7);
                  // Will only work if we can actually get the em value of the width
                  if (screen.width &lt; largescreeninpx) {
                       // Small or medium screen, show map help below map
                      $("#maphelp").css('margin-top', 0);
                  } else {
                      // Larger screen, show map and map help side-by-side
                      $("#maphelp").css('margin-top', -screen.height*0.7);
                  }
                  break;
          }
      }
  </code></pre>
  
  <p>Although in CSS a landscape iPad will not trigger <code>@media screen and (min-width: 30em) and (max-width: 63.236em) {...}</code> (meaning it has a width of over 63.236ems), in the JS it triggers the <code>console.log('small screen')</code>, showing it has a screen width of less than 66.236ems when getting via JS?  </p>
  
  <p><strong>Original Question (pretty much answered)</strong>
  I'm trying to create a website around "<a href="http://goldilocksapproach.com/" rel="nofollow">The Goldilocks Approach</a>". Everything works great in the spread sheets, but I'm trying to dynamically set the height of an embedded map so that it is always 90% of the users current viewport height. However, next to the map could also be some "map help", permitting the browser viewport is large enough (in this case, 66.23ems. An iPad in portrait is over 66.23ems). Below is my code which is commented to show what is not working.  </p>
  
  <pre><code>function doOnOrientationChange() {
          // Orientation of device has changed, change the size of map and move the maphelp (if required)
          switch(window.orientation) {
              case -90:
              case 90:
                  // Orientation is landscape
                  $("#map").height(screen.width*0.9); // The screen width is the viewport height of the device because we're in landscape orientation
                  if ($(window).width() &gt; 66.23) { // Need this in ems
                       // Small or medium screen, show map help below map
                      $("#maphelp").css('margin-top', 0);
                  } else {
                      // Larger screen, show map and map help side-by-side
                      $("#maphelp").css('margin-top', -screen.width*0.9);
                  }
                  break; 
              default:
                  // Orientation is portrait
                  if ($(window).width() &lt; 66.23) { // Need this in ems
                       // Small or medium screen, show map help below map
                      $("#maphelp").css('margin-top', 0);
                  } else {
                      // Larger screen, show map and map help side-by-side
                      $("#maphelp").css('margin-top', -screen.height*0.9);
                  }
                  break;
          }
      }
  </code></pre>
  
  <p>So, my question is, how can I get it to trigger the correct response by checking in ems?</p>