Try the Most Addicted Game - Real Rocket Racing 3d Game

Monday, April 2, 2012

Pin It


How to add Add Stylish JQuery Text Resize Buttons To Posts in Blogger

 Here is the tutorial how to Add a text re-size buttons to your blogger posts. Using simple jQuery and colorful icons we can create a text re-size section to blogger posts. This gadget contains three buttons increase text size, decrease text size, and a reset button.
Lets see the step by step procedure:

Back up your template before you make changes.

* After logging into your blogger dashboard go to Template->Edit HTML->Proceed(tick the expand widget templates checkbox)

* Now paste the below code just above/before </head> tag
Note: remove the code in red color if you already added jQuery script to your blog.

 <!-- Start Text re size gadget -->
<script src='' type='text/javascript'/>

//ID, class and tag element that font size is adjustable in this array
//Put in html or body if you want the font of the entire page adjustable
var section = new Array(&#39;span&#39;,&#39;.section2&#39;);
section = section.join(&#39;,&#39;);

// Reset Font Size
var originalFontSize = $(section).css(&#39;font-size&#39;);
$(section).css(&#39;font-size&#39;, originalFontSize);
// Increase Font Size
var currentFontSize = $(section).css(&#39;font-size&#39;);
var currentFontSizeNum = parseFloat(currentFontSize, 10);
var newFontSize = currentFontSizeNum*1.2;
$(section).css(&#39;font-size&#39;, newFontSize);
return false;

// Decrease Font Size
var currentFontSize = $(section).css(&#39;font-size&#39;);
var currentFontSizeNum = parseFloat(currentFontSize, 10);
var newFontSize = currentFontSizeNum*0.8;
$(section).css(&#39;font-size&#39;, newFontSize);
return false;
<!-- End Text re size gadget -->

* Now find the <div class='post-header-line-1'/> code using Ctrl+F

* Next copy/paste the below code after/below <div class='post-header-line-1'/>
Note: This gadget is currently set to only display on posts only, to display it on the home page you have to remove the two parts of code which are in red color.

<!-- Start Text re size gadget  -->
<b:if cond='data:blog.pageType == "item"'>
<table border='0' style='float:right; margin-left:5px;'><tr><td><img border='0' src=''/> | <a class='increaseFont' style='cursor: pointer; cursor: hand;' title='Larger Text'><img src=''/></a>
<a class='decreaseFont' style='cursor: pointer; cursor: hand;' title='Smaller Text'><img src='' style='cursor: hand;'/></a>
<a class='resetFont' style='cursor: pointer; cursor: hand;' title='Reset Text Size'><img src='' style='cursor: hand;'/></a></td></tr></table>
<!-- End Text re size gadget -->

* Now find the following code <data:post.body/> and replace it with <span><data:post.body/></span> and save your template.
That's it.


Post a Comment