In browsers there is a function Ctrl + mouse wheel, which increases or reduces the page, but not all users are aware of such a function. How to use javascript to control the parameters of this browser object by clicking on a specific object on the page?

    2 answers 2

    As far as I know, you cannot control the zoom from javascript, just keep track of it. As an option - make several css files and change their parameter disabled by clicking on a particular object.

    • And how can you track? - chuikoff
    • one
      For example, insert two elements on a page: one has the width in percent, and the other in pixels and check the ratio of their lengths (if the percentages are calculated from the width of the screen). But then you still have to track the resizing of the window. novemberborn.net/2007/12/javascriptpage-zoom-ff3-128 Another option is to simply track keystrokes and the mousewheel. Maybe write in cookies. - ling
    • mmm, the second option is interesting) - chuikoff

    Use jQuery:

    $(document).animate({width:"+=100px",heigth:"+=100px"},time); 

    time is the time for which the zoom animation will occur. I think the rest is clear.

    • for what a minus? (( - alex7249
    • one
      I did not minus, but for my part I will note that I have no idea how to change the width of the document object, it is a conceptually inappropriate object. The closest to this is the body, but changing its width, of course, will not scale all the internal elements. - yozh