/ Published in: jQuery
                    
                                        
need to be reviewed
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
/**************************************************************************************************
8""""8 8"""" 8"""8
8 eeeeeee eeeee eeeee eeeee e e 8 eeeee eeeee eeeee 8 8 eeee eeeee e eeeee eeee
8eeeee 8 8 8 8 88 8 88 8 8 8 8eeee 8 88 8 8 8 8eee8e 8 8 " 8 " 8 8
88 8e 8 8 8 8 8 8 8e 8eee8 88 8 8 8e 8 8e 88 8 8eee 8eeee 8e eeee8 8eee
e 88 88 8 8 8 8 8 8 88 88 8 88 8 8 88 8 88 88 8 88 88 88 88 88
8eee88 88 8 8 8eee8 8eee8 88 88 8 88 8eee8 88 8 88 88 8 88ee 8ee88 88 88ee8 88ee
Script : Font resize (even smoother)
Version : 2
Authors : gordon
REQUIRES JQUERY
(testet with 1.3.2 min)
***************************************************************************************************/
// Konfiguration:
// Zu verwenden mit folgendem Html
// <a class="changefontsize" rel="10" href="#" title="Schrift klein"><span>klein</span></a>
// <a class="changefontsize" rel="" href="#" title="Schrift reset"><span>reset</span></a>
// <a class="changefontsize" rel="20" href="#" title="Schrift groß"><span>groß</span></a>
// Vergrößert alles inerhalb: #content
/***************************************************************************************************/
function initFontResize()
{
var orginalsize = $("#content").css("fontSize").substring(0, $("#content").css("fontSize").length-2);
var orginallh = $("#content").css("lineHeight").substring(0, $("#content").css("lineHeight").length-2);
if(getCookie('atikonfontsize')!="")
{
setSize(getCookie('atikonfontsize'), orginalsize, orginallh, 1);
}
$(".changefontsize").click(function(){
//Resetting
if(!$(this).attr("rel"))
{
setSize(orginalsize, orginalsize, orginallh, 0);
setCookie("atikonfontsize", "")
}
//Resizing
else
{
setSize($(this).attr("rel"), orginalsize, orginallh, 0);
}
});
}
function setSize(size, orginalsize, orginallh, animationdisable)
{
if(size && orginalsize && orginallh)
{
// setCookie("atikonfontsize", size, "/")size
document.cookie = "atikonfontsize="+size+"; path=/;";
if(animationdisable == 1)
{
$("#content").css({fontSize: size+"px", lineHeight: Math.round( orginallh / ( orginalsize / size ) ) + "px" });
return false;
}
$("#content").animate({fontSize: size+"px", lineHeight: Math.round( orginallh / ( orginalsize / size ) ) + "px" },600);
}
}
$(document).ready(function() {
initFontResize();
});
/*
COOCKIE FUNCTIONS
*/
function getCookie(c_name)
{
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1)
{
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return "";
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                