www.webdeveloper.com
Results 1 to 4 of 4

Thread: How to zoom div content by using javascript?

Hybrid View

  1. #1
    Join Date
    Jul 2012
    Posts
    32

    How to zoom div content by using javascript?

    How to zoom div content by using javascript?I am adding the my code below.But it is not supporting all browsers.
    <html>
    <head>
    <script type="text/javascript">
    function zoomings(){
    var val=document.getElementById("zooming").value;

    //alert(val);
    searches.style.zoom=val;

    searches.style.moz.zoom=val;
    }
    </script>
    </head>
    <body>

    <span>Zoom</span><select id='zooming' onchange="zoomings()">
    <option value="25%">25%</option>
    <option value="50%">50%</option>
    <option value="75%">75%</option>
    <option value="100%" selected="selected">100%</option>
    <option value="150%">150%</option>
    <option value="200%">200%</option>
    <option value="250%">250%</option>
    <option value="300%">300%</option>
    </select>

    </body>
    </html>

  2. #2
    Join Date
    Feb 2010
    Posts
    6
    I don't think you're really going to get this script to work on all browsers. You should offer a lot more of you're code if you want precise help. Aside from writing a script for you, or directing you to another script that already does this, no one will be able to help you yet.

    Please give more of your code. Where is "searches" class / id?

    - Josh

    Katy West Houston Air
    Katy Air

  3. #3
    Join Date
    Jul 2012
    Posts
    32
    <html>
    <head>
    <script type="text/javascript">
    function zoomings(){
    var val=document.getElementById("zooming").value;

    //alert(val);
    searches.style.zoom=val;

    searches.style.moz.zoom=val;
    }
    </script>
    </head>
    <body>

    <span>Zoom</span><select id='zooming' onchange="zoomings()">
    <option value="25%">25%</option>
    <option value="50%">50%</option>
    <option value="75%">75%</option>
    <option value="100%" selected="selected">100%</option>
    <option value="150%">150%</option>
    <option value="200%">200%</option>
    <option value="250%">250%</option>
    <option value="300%">300%</option>
    </select>
    <div id="searches">
    Some Content Here
    </div>
    </body>
    </html>

  4. #4
    Join Date
    Mar 2011
    Posts
    1,145
    You could theoretically use some JavaScript to get cross-browser zooming if you use percentages and ems for all of the size properties of the contents of the "searches" <div>. Then all you have to do is modify the settings on the "searches" <div>. But as a practical matter, a lot depends on the content and the layout of the rest of the page.
    Rick Trethewey
    Rainbo Design

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles