Text size zoom features in SharePoint

No.of Views972
Bookmarked0 times
Downloads 
Votes3
By  trushar82   On  16 Feb 2010 03:02:06
Tag : SharePoint , Development and Programming
How to increase and decrease text size zoom features in SharePoint
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

 

Sharepoint Text Size zoom functionality is useful in organization for low resolution projector.

Here i have mentions step to integrate with sharepoint site.

 

(1) Open Sharepoint Site in sharepoint Designer .
 
(2) Open _catalogs folder and create new folder "JS"
 
(3) Add new javascript into that rename as TextSize.js
 
(4) Open Javascript and add below code into js and save it.
 

 
function FontSizeChange_SetAllDocumentFontSize(size)
{
FontSizeChange_ChangeAllElements(document, size);

for(var i = 0; i < document.frames.length; i++)
{
FontSizeChange_ChangeAllElements(document.frames[i].document, size)
}
}

function FontSizeChange_RestoreDefault()
{


FontSizeChange_ReloadWindow(true);
}

function FontSizeChange_ReloadWindow(refresh)
{
if(refresh)
{
var url = window.location.href;
if(url.indexOf("#") == url.length - 1)
{
window.location.href = url.substring(0, url.length - 1)
}
else
{
window.location.href = url;
}
}
else
{
window.location.reload();
}
}
function FontSizeChange_ChangeAllElements(doc, size)
{
FontSizeChange_SetFontSizeByTagName(doc, "div", size);
FontSizeChange_SetFontSizeByTagName(doc, "span", size);
FontSizeChange_SetFontSizeByTagName(doc, "input", size);
FontSizeChange_SetFontSizeByTagName(doc, "a", size);
FontSizeChange_SetFontSizeByTagName(doc, "td", size);
FontSizeChange_SetFontSizeByTagName(doc, "th", size);
FontSizeChange_SetFontSizeByTagName(doc, "select", size);
FontSizeChange_SetFontSizeByTagName(doc, "font", size);
FontSizeChange_SetFontSizeByTagName(doc, "textarea", size);
FontSizeChange_SetFontSizeByTagName(doc, "IE:MENUITEM", size);
}

function FontSizeChange_Increase()
{
var font=document.getElementById('txtFont').value;
if(font <20)
{
document.getElementById('txtFont').value=parseInt(document.getElementById('txtFont').value) + 1;
}

var fontSize = font.toString() + "px";
FontSizeChange_SetFontSize(fontSize);


}

function FontSizeChange_SetFontSize(size)
{
FontSizeChange_SetAllDocumentFontSize(size);

}

function FontSizeChange_Decrease()
{
var font=document.getElementById('txtFont').value;
if(font > 8)
{
document.getElementById('txtFont').value=parseInt(document.getElementById('txtFont').value) - 1;
}

var fontSize = font.toString() + "px";
FontSizeChange_SetFontSize(fontSize);

}


function FontSizeChange_SetFontSizeByTagName(doc, tag, size)
{
var elements = doc.getElementsByTagName(tag);
for(var i = 0; i < elements.length; i ++)
{
elements[i].style.fontSize = size;
}
}

 
 
(5) Open Master page and add below script.
 
 
(6) Also add below code into master page top corner.
 
  
<a title="Decrease Text Size"></a>

<a title="Default Text Size"></a>

<a title="Increase Text Size"></a>

<input id="txtfont" value="12" type="hidden" />
 
Add image as per your requirement.After complete this procedure, feature is look like below.
 
Image Loading
 
That'a all , thank you for reading and your time.

 
Sign Up to vote for this article
 
About Author
 
trushar82
Occupation-Software Engineer
Company-www.allscripts.com
Member Type-Fresh
Location-India
Joined date-02 Nov 2009
Home Page-
Blog Page-http://sharepointdata.blogspot.com
 
 
Other popularSectionarticles
Comments
By:SharepointDate Of Posted:9/7/2010 4:01:58 PM
Where to add in master page
Can you please clerify step 5 and 6 (5)Open master page and add below script? Where in master page this script should be added. (6)Also add below code in the master page top conrner. ? Under which tag on master page , this should be added.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top