Changeset 541 for trunk


Ignore:
Timestamp:
Apr 30, 2007, 2:34:52 PM (13 years ago)
Author:
Nick Burch
Message:

Scale the front page map to fit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/london.npemap.org.uk/index.html

    r539 r541  
    2323</div>
    2424
    25 <div class="mid-col">
     25<div class="mid-col" id="map-col">
    2626        <noscript>
    2727         This site requires javascript
     
    3131   <img src="/thumbnail.jpg" alt="Map of London" id="link" />
    3232   <br />
    33    <i>These maps are reproduced by kind permission of the Geographers' A-Z Map
    34     Company, and are still in <a href="/FAQ.html#licence">copyright</a>.</i>
     33   <i>These maps are reproduced by kind permission of
     34        the Geographers' A-Z Map Company, and are still in
     35        <a href="/FAQ.html#licence">copyright</a>.</i>
    3536 </div>
    3637</div>
     
    5657// Attach an onclick action to the thumbnail image
    5758YAHOO.util.Event.addListener("link", "click", click);
     59
     60// Attach a resize helper
     61YAHOO.util.Event.addListener(window,'resize',doResize);
     62
     63screenWidth = -1;
     64screenHeight = -1;
     65function doResize() {
     66  var newWidth = YAHOO.util.Dom.getViewportWidth();
     67  var newHeight = YAHOO.util.Dom.getViewportHeight();
     68  if (screenHeight != newHeight || screenWidth != newWidth) {
     69        screenWidth = YAHOO.util.Dom.getViewportWidth();
     70        screenHeight = YAHOO.util.Dom.getViewportHeight();
     71
     72                // Tweak the map size if required
     73                var img_width = 624;
     74                var img = $('link');
     75                var text = $('map-col');
     76                if(screenWidth >= 1175) {
     77                        img.style.width = img_width + "px";
     78                        text.style.width = '55%';
     79                } else if(screenWidth >= 1000) {
     80                        img.style.width = (screenWidth - 530) + "px";
     81                        text.style.width = (screenWidth - 520) + "px";
     82                } else if(screenWidth >= 700) {
     83                        img.style.width = (screenWidth - 500) + "px";
     84                        text.style.width = (screenWidth - 490) + "px";
     85                } else {
     86                        img.style.width = (screenWidth - 370) + "px";
     87                        text.style.width = (screenWidth - 360) + "px";
     88                }
     89  }
     90}
     91doResize();
    5892</script>
    5993
Note: See TracChangeset for help on using the changeset viewer.