1
demian
Font Resizer In Theme ?
  • 2010/2/14 5:50

  • demian

  • Quite a regular

  • Posts: 225

  • Since: 2008/4/29


Is there any recommended font resizer script in theme that i can use...

if possible i would like to have 3 option

enlarge | reduce | reset back to normal

i know most browser have this option..

but one of my friend insist to have this feature...

Thank you

2
ghia
Re: Font Resizer In Theme ?
  • 2010/2/14 6:07

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Some Morphogenesis based themes have this option. You can copy the scripts from some themes by Kris or Burning.

3
demian
Re: Font Resizer In Theme ?
  • 2010/2/14 8:33

  • demian

  • Quite a regular

  • Posts: 225

  • Since: 2008/4/29


ok i'm trying to adapt the font resizer from


morphogenesis3


i copied morpho.js to my themes js folder

/*
 * Mor.pho.GEN.e.sis 3.0
 *
 * @package         themes
 * @since           2.4.x
 * @maintained      Afux <http://www.afux.org>
 *
 * @version         $Id
*/

/* text sizer */
    
function fsize(size,unit,id){
      var 
vfontsize document.getElementById(id);
      if(
vfontsize){
       
vfontsize.style.fontSize size unit;
      }
    }

var 
textsize 1;
    function 
changetextsize(up){
      if(
up){
       
textsize parseFloat(textsize)+0.05;
      }else{
       
textsize =parseFloat(textsize)-0.05;
      }
    }

/* show hide id */
    
function xoToggleBlockid )
        {
        var 
value = (document.getElementById(id).style.display == 'none') ? 'block' 'none';
        
xoSetBlockidvalue );
        
xoSetCookieidvalue );
        }
    function 
xoSetBlockidvalue )
        {
        
document.getElementById(id).style.display value;
        }
    function 
xoTrimstr )
        {
        return 
str.replace(/^s+|s+$/g'') ;
        }
    function 
xoGetCookiename )
    {
     var 
cookieName 'XoMorpho_' name;
     var 
cookie document.cookie;

     var 
cookieList cookie.split";" );
        for( var 
idx in cookieList )
    {
    
cookie cookieList[idx].split"=" );
        if ( 
xoTrimcookie[0] ) == cookieName )
            {
        return( 
cookie[1] );
      }
     }
    return 
'none';
        }
        function 
xoSetCookienamevalue )
        {
     var 
cookieName 'XoMorpho_' name;
     var 
expires = new Date();
     
expires.setTimeexpires.getTime() + (365 24 60 60 1000));
     
document.cookie cookieName "=" value "; expires=" expires ";";
    }


<script src="http://xxxxxxxx/themes/xxxxxxxxxx/js/morpho.js" type="text/javascript"></script>


change x0-canvas colum to mainBody...copy all the icon image to my theme folder

<a href="javascript:fsize(textsize,'em','mainBody');" onclick="changetextsize(1);" title=""><img class="xo-icons" src="<{xoImgUrl icons/action/zoom_in.png}>" alt="A +" title="<{$smarty.const.THEME_ACCESS_PLUS}>" /></a>
<
a href="javascript:fsize(1,’em’,'mainBody’);" onclick="textsize = 1" title=""><img class="xo-icons" src="<{xoImgUrl icons/action/zoom_reset.png}>" alt="A =" title="<{$smarty.const.THEME_ACCESS_RESET}>" /></a>
<
a href="javascript:fsize(textsize,'em','mainBody');" onclick="changetextsize(0);" title=""><img class="xo-icons" src="<{xoImgUrl icons/action/zoom_out.png}>" alt="A -" title="<{$smarty.const.THEME_ACCESS_MINUS}>" /></a>


all is working except the
the reset button ...when clicking nothing happens

help......

4
ghia
Re: Font Resizer In Theme ?
  • 2010/2/14 12:24

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


The reset link has some wrong quotes.
Probably it was never noticed, because the morpho theme has only two buttons and the reset button is in HTML comments.

5
demian
Re: Font Resizer In Theme ?
  • 2010/2/14 14:49

  • demian

  • Quite a regular

  • Posts: 225

  • Since: 2008/4/29


yes the reset code initially was put it in comment

i comment it out...

any way to fix ?

6
demian
Re: Font Resizer In Theme ?
  • 2010/2/14 17:54

  • demian

  • Quite a regular

  • Posts: 225

  • Since: 2008/4/29


ok solved this
<a href="javascript:fsize(1,'em','mainBody');" onclick="textsize = 1;" title="Reset">Reset</a>

7
mariane
Re: Font Resizer In Theme ?
  • 2010/2/14 19:51

  • mariane

  • Theme Designer

  • Posts: 649

  • Since: 2008/1/11


hello,
maybe you find a solution in this page
http://www.dynamicdrive.com/dynamicindex9/textsizer.htm

8
jimmyx
Re: Font Resizer In Theme ?
  • 2010/5/7 14:57

  • jimmyx

  • Quite a regular

  • Posts: 338

  • Since: 2007/7/18


im using demian code..

the font sizer is ok...but when i change to another page my font backs to normal size...what did i do wrong ?

9
ghia
Re: Font Resizer In Theme ?
  • 2010/5/7 15:10

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Check if a cookie was set and that the domain corresponds.

10
jimmyx
Re: Font Resizer In Theme ?
  • 2010/5/7 15:37

  • jimmyx

  • Quite a regular

  • Posts: 338

  • Since: 2007/7/18


how do i check this ?

i can login to my site..does that mean..my cookie is set ?

Login

Who's Online

164 user(s) are online (105 user(s) are browsing Support Forums)


Members: 0


Guests: 164


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits