Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    May 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Is it possible to imitate browser zoom with Javascript!?

    Does anyone have any idea how to imitate browser zoom with javascript?

    I know you are not allowed to control browser's zoom capabilities, but perhaps there's a way to change all content dimensions with javascript?

    In firefox, when you press ctrl+, the whole page resizes appropriately, even background images.

    With this imitation JS zoom, background images would not zoom since there is no scale size numer or anything like that in CSS.

    It would simply be cool to have a script that resizes everything on the page. That way, you can design highdefinition content that fits a 1280 * 960 browser frame, but can zoom out for smaller resolutions (1024 or 800).

    That's be neato!!

    Any ideas? Anyone know a script?

  • #2
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,413
    Thanks
    13
    Thanked 357 Times in 353 Posts
    if you define your dimensions in relative units (em, ex, %) you can zoom these by increasing the base size (e.g. if you set relative font sizes and in the body one fixed size, changing that will also change the relative sizes).
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  • #3
    New to the CF scene
    Join Date
    May 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmmmm. Good idea. So can you use 'em' for dimensions like width and height of block objects? What about 'ex', Will that work with the block model as well?

    I haven't tried it yet, but i'm guessing that if the current font size is 12px, then i can make a box with dimensions 144x144 (px) by using 12em x 12em ?

  • #4
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,413
    Thanks
    13
    Thanked 357 Times in 353 Posts
    Quote Originally Posted by trusktr View Post
    So can you use 'em' for dimensions like width and height of block objects?
    as long as the browser supports that, of course. there are some comparison tables out there, that list which browser supports what units in the CSS. (quirksmode seems a good place to start)
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  • #5
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •