Text Zoom

From Wiki openElement
Jump to: navigation, search

This script allows users to zoom in and zoom out of text.

Element Used: Code Block.


<script language=javaScript>
// <!--
// Enter modifications below
 var maxfontsize=40
 var textcolor="AAAAAA"
 var textfont="Arial"
 var message="YOUR TEXT HERE"
 // end modifications
 var thissize=0
 var step=1
 
function stretch() {
if (thissize<0) {step=1; thissize=0}
if (thissize < maxfontsize) {
 if(document.all) {
 zoomer.innerHTML="<span style='font-family:"+textfont+";font-size:"+thissize+"px;color:"+textcolor+"'>"+message+"</span>"
 }
 if(document.layers) {
 document.zoomer.document.write("<span style='font-family:"+textfont+";font-size:"+thissize+"px;color:"+textcolor+"'>"+message+"</span>")
 document.close()
 }
 step++
 thissize=thissize+step
 var timer=setTimeout("stretch()",50)
 }
 else {
 clearTimeout(timer)
 var intermezzo=setTimeout("shrink()",1000)
 }
 }
 
function shrink() {
if (thissize > -0) {
 if(document.all) {
 zoomer.innerHTML="<span style='font-family:"+textfont+";font-size:"+thissize+"px;color:"+textcolor+"'>"+message+"</span>"
 }
 if(document.layers) {
 document.zoomer.document.write("<span style='font-family:"+textfont+";font-size:"+thissize+"px;color:"+textcolor+"'>"+message+"</span>")
 document.close()
 }
 if (step >= 2) {step=step-1} else{step=1}
 thissize=thissize-step
 var timer=setTimeout("shrink()",50)
 }
 else {
 clearTimeout(timer)
var intermezzo=setTimeout("stretch()",1000)
 }
 }
 // -->
 </script>
  <BODY> :
<Body onLoad="stretch()">
<BODY> :
 
<div id="zoomer" style="position:absolute;visibility:visible;top:10px; left:10px"></div>
Personal tools
Namespaces

Variants
Views
Actions
openElement
Community
Toolbox