Bootstrap Templates Bundle

Thursday, January 17, 2013

Allow user to change font size- Fluid Text Resizer



Step 1: Add the following code to the <HEAD> section of your web page:

<!-- font -->
<style type="text/css">

.controlstyle a{ /*links inside DIV sizecontroldiv*/
outline:none;
float: right;
}

.controlstyle a img{ /*image links inside DIV sizecontroldiv*/
border-width:0;float: right;
}

.controlstyle a.selectedcontrol img{ /*selected control's image*/
border-bottom:4px solid darkred;
}

</style>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

<script type="text/javascript" src="http://www.dynamicdrive.com/dynamicindex9/fluidtextresizer.js">

/***********************************************
* Fluid Text Resizer- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

</script>

<script type="text/javascript">

var mytextsizer=new fluidtextresizer({
controlsdiv: "sizecontroldiv", //id of special div containing your resize controls. Enter "" if not defined
targets: ["body"], //target elements to resize text within: ["selector1", "selector2", etc]
levels: 3, //number of levels users can magnify (or shrink) text
persist: "session", //enter "session" or "none"
animate: 200 //animation duration of text resize. Enter 0 to disable
})

</script>


<!-- font -->

Step 2: Now add the following sample resize controls to your page:



 <!-- font -->

<div id="sizecontroldiv" class="controlstyle">

 <a href="#smaller"><img src="http://jnnews24.com/wp-content/uploads/2013/01/fontminus.gif" /></a> <a href="javascript:mytextsizer.setFontLevel(0)"><a href="#fontsize2"><img src="http://jnnews24.com/wp-content/uploads/2013/01/2.gif" /></a></a> <a href="#bigger"><img src="http://jnnews24.com/wp-content/uploads/2013/01/fontplus.gif" /></a>

<!-- font -->

Source:  http://www.dynamicdrive.com/dynamicindex9/fluidtextresizer.htm



No comments:

Post a Comment

Nightery - Night Club WordPress Theme

Nightery - Night Club WordPress Theme Nightery – Night Club WordPress Theme is an awesome design idea for your Night Club, Conce...