Web Analytics Made Easy -
StatCounter Can I have a window measured by font size? - CodingForum

Announcement

Collapse
No announcement yet.

Can I have a window measured by font size?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can I have a window measured by font size?

    To make sure a popup window has a consistant appearance across various screen resolutions, the window size shall vary based on the resolution. Can I have a popup window measured by the font size, something like the "em" in CSS?

    Thanks for your inputs.
    vicina.info - Selected News Feed and More

  • #2
    You could quite easily set the content width depending on the font size by including all of your content inside a div tag with a width set using em's, however I'm not sure about the window size.

    IMO it would be easier to just have a set window size but make sure that your inline content can collapse in width gracefully and so create a more fluid layout.
    AMD Athlon "Barton" XP 3200+ (11*200.5MHz = 2.2GHz)
    BFG GeForce 6800 Ultra OC 256Mb
    3 * Kingston 256Mb PC3200 DDR400
    Seagate Barracuda 120Gb Ultra ATA-100 and Seagate Barracuda 160Gb, SATA-150

    Comment


    • #3
      Hi,

      Thanks for your response.

      I get your point. But the popup window size seems having a better fit with the content. I find the follow javascript code which is close to my need. Unfortunately, it has an error. I can't find out any problems on the line.

      function showpopup() {

      var putItThere = null;
      var chasm = screen.availWidth;
      var mount = screen.availHeight;
      var wd = chasm*.9; // percentage of screen width occupied by pop-up
      var ht = mount*.8; // percentage of screen height occupied by pop-up

      // The following line has an error. What it is?
      putItThere = window.open('...','Tour','width='+wd+',height='+ht+', left='+((chasm-wd-10)*.5)+',top='+((mount-ht-25)*.5)+',scrollbars,status,titlebar');

      return true;

      }
      vicina.info - Selected News Feed and More

      Comment


      • #4
        You could simplify that code so much you know, but no matter, I think I see your error. I have a screen resolution of 1024x768, I'll work out the numbers for that:

        chasm - wd = 1024 - 921.6 = 102.4
        102.4 * 0.5 = 51.2

        mount - ht - 25 = 768 - 614.4 - 25 = 128.6
        128.6 * 0.5 = 64.3

        So you are making a window which is 51.2px to the left and 64.3px down. I don't think you can do 0.2 of a pixel.

        It seems as though you are trying to centre the pop-up window both horizontally and vertically, to do that you could just do this:

        Code:
        var chasm = screen.availWidth;
        var mount = screen.availHeight;
        
        var putItThere = window.open('... ','Tour','width='+Math.round(chasm*0.9)+',height='+Math.round(mount*0.9)+',left='+Math.round(chasm*0.1-5)+',top='+Math.round(mount*0.1-12.5)+',scrollbars,status,titlebar');
        AMD Athlon "Barton" XP 3200+ (11*200.5MHz = 2.2GHz)
        BFG GeForce 6800 Ultra OC 256Mb
        3 * Kingston 256Mb PC3200 DDR400
        Seagate Barracuda 120Gb Ultra ATA-100 and Seagate Barracuda 160Gb, SATA-150

        Comment


        • #5
          This is double-posted...
          Former ASP Forum Moderator - I'm back!

          If you can teach yourself how to learn, you can learn anything. ;)

          Comment

          Working...
          X