Tuesday, February 28, 2012

Zoom In Zoom Out Contents of Page using JQuery CSS3

// Include JQuery File
<script type="text/javascript">
        $(document).ready(function () {
            var currZoom = $("#divpnlChart").css("zoom");
            if (currZoom == 'normal') currZoom = 1; // For IE

            $(".zoomIn").click(function () {
                currZoom *= 1.2;
                $("#divpnlChart").css("zoom", currZoom);
                $("#divpnlChart").css("-moz-transform", "Scale(" + currZoom + ")");
                $("#divpnlChart").css("-moz-transform-origin", "0 0");

            });
            $(".zoomOff").click(function () {
            $("#divpnlChart").css("zoom", 1);
$("#divpnlChart").css("-moz-transform", "Scale(" + currZoom + ")");
            $("#divpnlChart").css("-moz-transform-origin", "0 0");

            });
            $(".zoomOut").click(function () {
                currZoom *= .8;
              $("#divpnlChart").css("zoom", currZoom);
              $("#divpnlChart").css("-moz-transform", "Scale(" + currZoom + ")");
              $("#divpnlChart").css("-moz-transform-origin", "0 0");

            });
        });
</script>

//  HTML Code

<span class="zoomIn" style="font-size:120%">A</span>
<span class="zoomOff">A</span>
<span class="zoomOut" style="font-size:80%">A</span>

<div id="divpnlChart" runat="server" style="float: left; width: 85%;">
    //  your content
</div>