Changeset 265


Ignore:
Timestamp:
Nov 1, 2006, 2:14:33 PM (13 years ago)
Author:
David Sheldon
Message:

Fix resizing on safari. It doesn't like setting innerHTML.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/static/tiles/mapTiles.js

    r264 r265  
    215215  sizeGridX = Math.floor(((screenWidth -210) / tileWidth));
    216216  sizeGridY = Math.floor(((screenHeight -130) / tileHeight));
    217  
    218   page = '';
     217  var map = $('map');
     218  map.innerHTML = '';
    219219  for(var y=sizeGridY; y>=1; y--) {
    220220    for(var x=1; x<=sizeGridX; x++) {
    221       page += '<img width=' + tileWidth + ' height=' + tileHeight + ' id=element' + x + '.' + y + '>';
     221                        map.appendChild(createIMG(tileWidth, tileHeight, 'element'+x+'.'+y));
    222222     }
    223      page += '<br>';
     223                 map.appendChild(document.createElement('br'));
    224224  }
    225225 
    226   $('map').innerHTML = page
    227226  $('map').style.width = sizeGridX * tileWidth ;
     227}
     228
     229function createIMG(width, height, id) {
     230  var img = document.createElement('img');
     231        img.width = width;
     232        img.height = height;
     233        img.id = id;
     234        return img;
    228235}
    229236
Note: See TracChangeset for help on using the changeset viewer.