Implementing Zoom functionality in asp.net
Zoom functionality in asp.net
1. Write the Below code in the <head> Tag
<script type="text/javascript">
function BrowserZoomPluse() {
nzoom = parseInt(divTest.style.zoom) + 30 + '%';
divTest.style.zoom = nzoom ;
}
function BrowserZoomMinuse() {
nzoom = parseInt(divTest.style.zoom) - 10 + '%';
divTest.style.zoom = nzoom ;
}
function ResetZoom() {
nzoom = parseInt(divTest.value);
divTest.style.zoom = '100%';
}
</script>
2. Add the below Code inside the <body> tag
<div id="divTest" style="zoom: 100%">
<div class="textsize">
<a href="javascript:void(0);" onclick="BrowserZoomPluse();">
Zoom + </a>
<a href="javascript:void(0);" onclick="BrowserZoomMinuse();">
Zoom - </a>
<a href="javascript:void(0);" onclick="ResetZoom();">
Reset </a>
</div><br />
</div>
3. Run the Page and click on Zoom In ,Zoom Out and Reset
Note: zoom works on chrome ,safari and IE .
1. Write the Below code in the <head> Tag
<script type="text/javascript">
function BrowserZoomPluse() {
nzoom = parseInt(divTest.style.zoom) + 30 + '%';
divTest.style.zoom = nzoom ;
}
function BrowserZoomMinuse() {
nzoom = parseInt(divTest.style.zoom) - 10 + '%';
divTest.style.zoom = nzoom ;
}
function ResetZoom() {
nzoom = parseInt(divTest.value);
divTest.style.zoom = '100%';
}
</script>
2. Add the below Code inside the <body> tag
<div id="divTest" style="zoom: 100%">
<div class="textsize">
<a href="javascript:void(0);" onclick="BrowserZoomPluse();">
Zoom + </a>
<a href="javascript:void(0);" onclick="BrowserZoomMinuse();">
Zoom - </a>
<a href="javascript:void(0);" onclick="ResetZoom();">
Reset </a>
</div><br />
</div>
3. Run the Page and click on Zoom In ,Zoom Out and Reset
Note: zoom works on chrome ,safari and IE .
Hi,
ReplyDeleteIts working fine in chrome and ie but its not working when the browser has default add on feature zoom in and zoom out(especially with Firefox)thanks for this simplified java script.
Thanks
ReplyDeleteGreat work...!
ReplyDeleteGood job Ajay :)
ReplyDelete